Recent Questions - Signal Processing Stack Exchange most recent 30 from dsp.stackexchange.com 2019-12-16T05:14:55Z https://dsp.stackexchange.com/feeds https://creativecommons.org/licenses/by-sa/4.0/rdf https://dsp.stackexchange.com/q/62616 1 Implementing the noisy AR(1) Process Jason https://dsp.stackexchange.com/users/45700 2019-12-16T00:58:36Z 2019-12-16T00:58:36Z <p>I'm trying to implement noisy AR(1) process and plot it. The observed noisy sequence x(n) = s(n) + w(n) where variance of w(n) = 0.2. </p> <p>s(n) is defined as an AR(1) process with s(n) = 0.5 s(n-1) + e(n), for n=1:100, s(0) = 0 and the variance of e(n) = 1. w(n) and e(n) are independent.</p> <p>I first do the following:</p> <pre><code>N = 100; % number of process samples. a = [1, 0.5]; % denominator coefficients, p = 1. b = 1; % numerator coefficient. s = filter(b,a, randn(1,N)); % generate N sample of AR(1) nu = sqrt(0.2) * randn(1,N); x = s + nu; figure(1) plot(s,'r'); hold on; plot(x,'g'); legend('AR(1) Process','Noisy Process'); </code></pre> <p>Can anybody help me whether I do the correct thing. Any help would be appreciated.</p> https://dsp.stackexchange.com/q/62614 0 image resolution in smartphones and laptop Noha https://dsp.stackexchange.com/users/46733 2019-12-15T20:25:23Z 2019-12-15T22:43:06Z <p>If I used a smartphone with high pixel per inch (ppi) value for capturing an image with certain dimensions, what happened if this image is displayed on a laptop (larger screen) with:</p> <p>the same ppi value lower ppi value higher ppi value</p> <p>Do the dimensions of the image change? or still the same? Is interpolation required when displaying an image on a mobile phone different from the mobile phone that captured it, if both mobile phones have different ppi values?</p> https://dsp.stackexchange.com/q/62613 0 Relationship between wavelet shape and filter points M. Farooq https://dsp.stackexchange.com/users/41674 2019-12-15T19:32:46Z 2019-12-15T19:32:46Z <p>MATLAB has a library of wavelet functions, showing their "continuous forms" as well as the the decomposition and reconstruction filters.</p> <p>In decimated wavelet transform the filter size remains the same and the data points are downsampled by <span class="math-container">$2^j$</span> at every level <span class="math-container">$j$</span>. A question that I cannot find an answer is how are the wavelet filters and the actual continuous forms are related? I am chemist, exploring wavelets for some applications.</p> <p>For example, MATLAB has db9. Its continuous estimation, wavelet function, psi or phi do not look similar to the decomposition filter points. One text says that some wavelets start out as filter and later their continuous forms are estimated, but why in the case of db9 and many other, the filter points do not match the shape of the wavelet function?</p> <p>Thanks.</p> <p><a href="https://i.stack.imgur.com/ZrQQW.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZrQQW.jpg" alt="MATLAB wavelet library"></a></p> https://dsp.stackexchange.com/q/62612 1 Plotting a scalogram of a signal's Continuous Wavelet Transform (CWT) in python IsmailE https://dsp.stackexchange.com/users/43900 2019-12-15T16:22:06Z 2019-12-15T18:48:29Z <p>So I've been learning about wavelets for a few weeks because I'd like to use them in a research project I'm working on and I've been trying to grasp the general ideas behind them.I've been struggling with plotting the scalograms of a CWT of a signal.</p> <p><strong>I would really appreciate it if someone could go through my scalogram plotting function to see if I'm plotting this scalogram correctly. I'm mainly struggling on how to visualize the power levels of the signal in the scalogram, or if im even doing it correctly now</strong> </p> <hr> <p><strong>The Raw Signal and Scalogram Plots:</strong></p> <p>The sampling frequency of this signal is 2048hz and the length of the signal is 2048 samples so this is a 1 second sample of my signal. You can ignore the black lined signal in the first plot. I applied the cwt function on the raw blue signal using the pywavlets cwt function.</p> <p><a href="https://i.stack.imgur.com/qUYpj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qUYpj.png" alt="Example Signal and scalogram plots"></a></p> <hr> <p><strong>questions about my plot_wavelet function:</strong></p> <p><strong>1.</strong> In the function below there are hardcoded levels values. The log2 values are in the color bar on the right of the plot. These are used in the ax.contourf function for creating the contour lines. How should I go about determining how many levels to use or the values of the levels? This is the main thing I've been struggling with here. How to relate the power to color in the plot basically.</p> <p><strong>2.</strong> At this point in my scalogram plots I'm assuming that the areas closer to the value 0 have the most power. It kind of makes sense when i compare the location with what i see in the raw signal plot. Would this be a correct assumption? I'm wondering though how can I make the resolution of my graph better or is this even possible? If i use a longer range of scales i guess I can possibily increase the frequency band resolution? Is this the correct line of thinking. </p> <p><strong>3.</strong> How should I display my y-axis in the scalogram? The pywt.cwt function returns frequencies but I guess they are more like ranges of frequencies? I'm kind of stuggling as in understanding how exactly to interpret the y-axis... I've read so many different papers/ tutorials that I think I've confused myself a bit in regards to how to relate scale and frequency or how to plot it in this manner.</p> <p>plot_wavelet function code :</p> <pre><code>def plot_wavelet(ax, time2, signal, scales, waveletname = 'cmor', cmap =plt.cm.seismic, title = '', ylabel = '', xlabel = ''): dt=time2 coefficients, frequencies = pywt.cwt(signal, scales, waveletname, dt) power = (abs(coefficients)) ** 2 period = frequencies levels = [0.015625,0.03125,0.0625, 0.125, 0.25, 0.5, 1] contourlevels = np.log2(levels) #original time=range(2048) im = ax.contourf(time, np.log2(period), np.log2(power), contourlevels, extend='both',cmap=cmap) ax.set_title(title, fontsize=20) ax.set_ylabel(ylabel, fontsize=18) ax.set_xlabel(xlabel, fontsize=18) yticks = 2**np.arange(np.ceil(np.log2(period.min())), np.ceil(np.log2(period.max()))) ax.set_yticks(np.log2(yticks)) #original ax.set_yticklabels(yticks) #original ax.invert_yaxis() ylim = ax.get_ylim() cbar_ax = fig.add_axes([0.95, 0.5, 0.03, 0.25]) fig.colorbar(im, cax=cbar_ax, orientation="vertical") return yticks, ylim </code></pre> <hr> <p>the code to create the two above plots, remember you can ignore the black signal in the first plot. I performed the CWT on the original blue signal.</p> <pre><code> xrange=list(range(2048)) fig, ax = plt.subplots(figsize=(12,8)) ax.plot(xrange,signal, color="b", alpha=0.5, label='original signal') #rec = lowpassfilter(signal, 0.4) ax.plot(xrange,rec, 'k', label='DWT smoothing}', linewidth=2) ax.legend() ax.set_title('Removing High Frequency Noise with DWT', fontsize=18) ax.set_ylabel('Signal Amplitude', fontsize=16) ax.set_xlabel('Sample No', fontsize=16) plt.margins(0) plt.show() scale_range = np.arange(2, 50) # number of scales fig, ax = plt.subplots(figsize=(12, 8)) plot_wavelet(ax=ax, time2=sp, signal=signal, scales=scale_range,waveletname='cmor1.5-1.0', title = "CWT of Signal", ylabel = ylabel, xlabel = xlabel) plt.show() </code></pre> <p>Reference links:</p> <p><a href="https://ataspinar.com/2018/12/21/a-guide-for-using-the-wavelet-transform-in-machine-learning/" rel="nofollow noreferrer">Link to where I got the example i was following and where the ploting code is based from</a></p> <p><a href="https://pywavelets.readthedocs.io/en/latest/ref/cwt.html#single-level-cwt" rel="nofollow noreferrer">Link to pywavelets cwt function</a></p> https://dsp.stackexchange.com/q/62608 3 LTI, causal, discrete time system output Sam B https://dsp.stackexchange.com/users/39814 2019-12-15T07:45:25Z 2019-12-15T19:35:00Z <p>Consider a discrete time LTI causal system <span class="math-container">$S: y = S(u)$</span>, with its impulse response <span class="math-container">$h:{Z} \rightarrow R:h(n)=3^{n+1}{H(n)}$</span> with <span class="math-container">$H$</span> the Heaviside function. We know the values of input: </p> <p><span class="math-container">$$u(0) = 2$$</span> <span class="math-container">$$u(1) = 1$$</span> <span class="math-container">$$u(2) = 1$$</span> <span class="math-container">$$u(3) = 1$$</span> <span class="math-container">$$u(4) = 2$$</span></p> <p>Also the <span class="math-container">$y(2) = 66$</span>. I'm trying to find the value of <span class="math-container">$y(3)$</span>. </p> <p>I may say, for a LTI, causal system the output is the convolution of the input with the impulse response: </p> <p><span class="math-container">$$y(n) = \sum^\infty_{k=0}3^{k+1}u(n-k)$$</span></p> <p>Then </p> <p><span class="math-container">$$y(3) = 3u(3)+9u(2)+27u(1)+81u(0) = 201$$</span></p> <p>Which is the correct answer! But I don't understand, why should I stop at <span class="math-container">$u(0)$</span> or why the negative values of the input <span class="math-container">$u(n), n&lt; 0$</span> are zero here ?</p> <p>Alternative solution: </p> <p>recursion gives us this form:</p> <p><span class="math-container">$$y(n) = 3y(n-1)+3u(n)$$</span> </p> https://dsp.stackexchange.com/q/62603 0 Auto-correlation of C/A code with 30dB noise axk https://dsp.stackexchange.com/users/39925 2019-12-14T22:38:46Z 2019-12-15T15:13:59Z <p>I've a C# program that generates a GPS C/A code consisting of -1s and +1s.<br> Auto correlating the code with rotated versions of itself shows that the peak is 1023 and the next maximum value is 63 which agrees with what I expect.</p> <p>Now my understanding is that in the GPS C/A signal the SNR is -30dB and the receiver is still able to detect a strong auto-correlation peak.</p> <p>So I'm adding a random numbers between 0 and 30 (roughly 30dB) to one of the signals before the auto-correlation and now there's no strong peaks.</p> <p><a href="https://i.stack.imgur.com/NTX2V.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NTX2V.png" alt="C/A code auto-correlation with 30dB pseudo-random noise"></a></p> <p>Where is the mistake in my reasoning?</p> <pre><code>using System; using System.Collections.Generic; using System.Linq; namespace CrosssCorrelationTest { class Program { static void Main(string[] args) { List&lt;int&gt; caCode = GenerateCaCode(); var shiftedCaCode = new Queue&lt;int&gt;(caCode); AddNoise(caCode); double correlation = 0; double max1 = 0, max2 = 0; for(int i=1; i&lt;1023; i++) { correlation = CrossCorrelate(caCode, shiftedCaCode.ToList()); if(correlation &gt; max1) { max2 = max1; max1 = correlation; } else if(correlation &gt; max2) { max2 = correlation; } RotateBy1(shiftedCaCode); } Console.WriteLine($"max1={max1}; max2={max2}"); Console.ReadKey(true); } private static void AddNoise(List&lt;int&gt; caCode) { var r = new Random(); for(int i=0; i&lt;caCode.Count; i++) { caCode[i] += r.Next(30); } } private static double CrossCorrelate(List&lt;int&gt; caCode, List&lt;int&gt; caCode1) { int sum = 0; for(int i =0; i&lt;caCode.Count; i++) { sum += caCode[i] * caCode1[i]; } return sum; } private static void RotateBy1(Queue&lt;int&gt; shiftedCaCode) { int chip = shiftedCaCode.Dequeue(); shiftedCaCode.Enqueue(chip); } private static List&lt;int&gt; GenerateCaCode() { int g1 = 1023; //10b'1111111111; int g2 = 1023; //10b'1111111111; var caCode = new List&lt;int&gt;(); for (int i=1; i&lt;=1023; i++) { int chip = (g1 ^ ((g2 &gt;&gt; 4) ^ (g2 &gt;&gt; 8))) &amp; 1; caCode.Add(chip == 1 ? 1 : -1); g1 = (g1 &gt;&gt; 1) | (((g1 &lt;&lt; 2) ^ (g1 &lt;&lt; 9)) &amp; 512); g2 = (g2 &gt;&gt; 1) | (((g2 &lt;&lt; 9) ^ (g2 &lt;&lt; 8) ^ (g2 &lt;&lt; 7) ^ (g2 &lt;&lt; 5) ^ (g2 &lt;&lt; 2) ^ (g2 &lt;&lt; 1)) &amp; 512); } return caCode; } } } </code></pre> https://dsp.stackexchange.com/q/62597 0 Wavelets: Reconstruction Filters for 2 Level Decomposition M. Farooq https://dsp.stackexchange.com/users/41674 2019-12-14T18:36:11Z 2019-12-15T10:01:00Z <p>I am trying to understand the reconstruction part after discrete wavelet decomposition and how do we get approximations and details at various levels. Most textbooks show the complete reconstruction diagrams but not how to get an approximations and details at various levels. </p> <p>Let us say we started with a s[n] and DWT is performed at level 2. I am following the diagram in Fugal's Conceptual Wavelets.<a href="https://i.stack.imgur.com/varAB.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/varAB.png" alt="DWT"></a></p> <p>We pass a high pass filter, we get (cD1) and a low pass filter, we get (cA1) on the signal. The cA1 is downsampled by 2, and then passed through the same high-pass and low pass filter giving us detail coefficients at level 2 (cD2), and approximation coefficients (cA2).</p> <p>How do get approximations A1, A2, and details D1 and D2?</p> <p>a) If we upsample cD1 by 2 and pass a reconstruction filter on it we will get D1. </p> <p>b) If we upsample cA2 by 2, and pass a low pass reconstruction filter, we should get A2.</p> <p>c) If we upsample cD1 by 2, and pass a high pass reconstruction filter, we should get D2.</p> <p>d) How is A1 obtained? As per the diagram in Fugal (Conceptual Wavelets), he combines the output at level 2, upsamples it again, passes it through a low pass reconstruction filter and gets A1. I believe this could have been done by passing the low pass reconstruction filter <em>directly</em> on cA1 as in point (a-c).</p> <p>I am asking because MATLAB displays the approximations and details at various levels.</p> <p>Thanks.</p> https://dsp.stackexchange.com/q/62592 2 image compression versus image denoising Noha https://dsp.stackexchange.com/users/24743 2019-12-14T14:27:37Z 2019-12-15T13:41:34Z <p>Wavelet based image denoising may be performed by thresholding (selecting a threshold value, and discarding all values below the threshold. Wavelet-based image compression may also be performed by a similar way. What is the difference then between the two operations? can we consider denoising a certain type of compression? </p> https://dsp.stackexchange.com/q/62590 0 Transforming digitized noisy signal before applying cross-correlation axk https://dsp.stackexchange.com/users/39925 2019-12-14T13:53:28Z 2019-12-15T15:08:43Z <p>I'm trying to grasp the concept of cross-correlation as it applies to CDMA in the GPS C/A signal where noise is involved and the SNR is low.</p> <p>My understanding is that before calculating the cross-correlation with the C/A code one has to transform (just shift by its average value?) the digitized and demodulated received signal so that there are both positive and negative values in the sequence and the sum of these on average should be zero, is this correct?</p> <p>(I understand that there's much more to acquiring the GPS C/A signal, but I'm trying to grasp how cross-correlation can be applied to a digitized signal)</p> https://dsp.stackexchange.com/q/62579 0 Adding Poisson noise to a time series signal pproctor https://dsp.stackexchange.com/users/40386 2019-12-14T00:12:37Z 2019-12-15T17:43:32Z <p>I'm working on a radiation detection problem. I have simulated some measurement count data and want to add an amount of Poisson background noise to achieve a certain SNR. Radiation count measurement (due to the background radiation) is given by the Poisson random variable. </p> <p>After searching the web, I'm not seeing any clear indication of how to go about it doing this. Is there a similar method as in the case of AWGN? (<a href="https://www.mathworks.com/help/comm/ref/awgn.html" rel="nofollow noreferrer">https://www.mathworks.com/help/comm/ref/awgn.html</a>).</p> <p><a href="https://i.stack.imgur.com/dQmXm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/dQmXm.png" alt="enter image description here"></a></p> https://dsp.stackexchange.com/q/61941 0 numpy.linalg.lstsq underdetermined case SchroedingersLion https://dsp.stackexchange.com/users/45984 2019-11-14T21:21:35Z 2019-12-16T02:02:40Z <p>I would like to understand what I am doing wrong here. I am trying to perform polynomial regression by minimizing the least squares, ||Au-y||^2, where y is the given data and A is the matrix where the i-th line holds [1, x_i, (x_i)^2, ... (x_i)^n-1].</p> <p>If n is larger than the number of data points, the problem is underdetermined, and I expect the numpy.linalg.lstsq() routine to give any of the infinitely possible solutions. But, as you can see, I don't get a solution at all.</p> <pre><code> import matplotlib.pyplot as plt import numpy as np x = np.array([-6 ,1, 2, 3, 4]) # x data y = np.array([2, -3, 4, 20, -10]) # y data A = [] n = 50 # polynomial degree for i in range(0,n): # create A matrix of proper form: i-th line is [1, x_i, x_i**2, ...] A.append(x**i) A=np.array(A) A=A.T u=np.linalg.lstsq(A,y, rcond=None) # solve underdetermined problem x_test=np.linspace(-6, 5, 100) # create more x values for plotting B=[] for i in range(0,n): # same as before, their power matrix B.append(x_test**i) B=np.array(B) B=B.T plt.plot(x_test, B@u) # plot polynom plt.scatter(x,y) # plot data plt.show() print(A@u-y) # this should be zero vector?? <span class="math-container">`</span> </code></pre> https://dsp.stackexchange.com/q/61899 0 duty cycle of a WiFi Packet Saira https://dsp.stackexchange.com/users/46188 2019-11-13T14:49:51Z 2019-12-15T16:02:50Z <p>I am doing a simple over-the-air(WiFi 802.11a) test in a shielded chamber involving one Tx and one Rx (around 5 feet).. I need to find the duty cycle given the length of the payload (in bytes), MCS etc. As far as I understand , duty cycle is time a device spent on channel / total time . I was going through this paper <a href="https://www.academia.edu/15142561/Determination_of_the_duty_cycle_of_WLAN_for_realistic_radio_frequency_electromagnetic_field_exposure_assessment" rel="nofollow noreferrer">https://www.academia.edu/15142561/Determination_of_the_duty_cycle_of_WLAN_for_realistic_radio_frequency_electromagnetic_field_exposure_assessment</a> Where the paper calculates the theoretical upper limit of duty cycle for a given MCS</p> <p><a href="https://i.stack.imgur.com/CmJV8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CmJV8.png" alt="enter image description here"></a></p> <p>The payload is 1500 bytes Max data rate is 54 Mbps</p> <p>How is the data 248 micro secs in calculations? I am thinking,it should be 222.22 micro seconds (1500*8/54 micro seconds)</p> <p>can any one please let me know about it </p> <p>And If anyone has done such analysis on duty cycles , please do guide me thanks </p> https://dsp.stackexchange.com/q/53479 0 Finding Signals when the baseline varies greatly by signal set TryingToLear https://dsp.stackexchange.com/users/38977 2018-11-19T21:55:12Z 2019-12-15T11:02:30Z <p>I have milliwatt consumption data from home appliances. I'm collecting this data in hundreds of households. Based on the machine model, the baseline value for a given household can vary from 0 to 500 milliwatts. The baseline non-zero values vary by 5 to 15 milliwatts and the data is reported every 13 seconds. The vast majority of data is baseline, and there is only signal when people are running the appliance. Perhaps 10 hours a week is real data. The signals are very pronounced, going from baseline to values exceeding 100,000. I have 1/3 of a billion records (growing by several million records a day) so signal detection must be automated.</p> <p>I really just need, start and end time of the event. We wrote python code that looked for the jump in signal value and return to baseline. The trouble is that each machine has a different baseline value. </p> <p>Are there simple tools/techniques that can determine from recent context the end of a pronounced signal? My preference is python but I'm happy to use anything that works. Thanks in advance for any feedback.</p> https://dsp.stackexchange.com/q/50733 2 How Does Mean Centering Affect the Result of Using SVD to Compress Images? Noppawee Apichonpongpan https://dsp.stackexchange.com/users/36861 2018-07-23T04:45:00Z 2019-12-15T15:03:05Z <p>I have been learning about using the Singular Value Decomposition to find low rank approximations to matrices. I had an image which I converted to a matrix. I regarded each row of the matrix as a 'data point'.</p> <p>I did two things:</p> <ol> <li>Found the mean of the data points then subtracted the mean from each data point and calculated the SVD of the result</li> <li>Directly calculated the SVD of the original data matrix</li> </ol> <p>Then I calculated the low rank approximations of the results from 1. and 2. by replacing some of the singular values with zeros. Finally I converted the results back to images.</p> <p>Both images looked quite similar. They both looked like how SVD-compressed images should look (according to textbooks).</p> <p>From a principal component analysis point of view, not mean-centering the data before finding the low-rank approximation shouldn't work well. It is equivalent to calculating the principal components from the eigenvectors of$\frac{1}{n-1}X^TX$(where$X$is the data matrix) instead of the covariance matrix of$X$. So why did it appear like mean-centering didn't matter? Or does it depend on the type of images?</p> https://dsp.stackexchange.com/q/50417 2 Binarization, and then thinning/skeletonization Liris https://dsp.stackexchange.com/users/36595 2018-07-10T07:47:24Z 2019-12-15T10:01:45Z <p>I have pictures of networks, like the one below, and my goal is to obtain the network's skeleton from processing those images.</p> <p><a href="https://i.stack.imgur.com/WXkRR.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WXkRR.jpg" alt="original image"></a></p> <p>My approach lies in two steps, first I convert grayscale image to binary image using local thresholding or Otsu method, and then a medianfilter (python function medfilt). Result is shown below.</p> <p><a href="https://i.stack.imgur.com/UWiMD.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/UWiMD.jpg" alt="Binary image"></a></p> <p>Then, I use a thinning algorithm to extract the network's skeleton. Here is the result of my implementation of the Zhang-Suen thinning algorithm.</p> <p><a href="https://i.stack.imgur.com/amMim.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/amMim.jpg" alt="Skeleton"></a></p> <p>Considering the quality of the first image, I'm pretty sure it's possible to do a lot better than that. I thus have two questions :</p> <p>1) Taking the last image, how would you remove all the small lines perpendendicular to the ridges, and the small gaps, that are artefacts ?</p> <p>2) What algorithm would you actually advise me to use for the above mentionned steps (conversion to binary image and thinning) ?</p> <p>I'm mainly working in python.</p> https://dsp.stackexchange.com/q/50071 0 How to choose the right segment length for a given signal? Learner12 https://dsp.stackexchange.com/users/4770 2018-06-22T14:27:18Z 2019-12-15T14:00:45Z <p>Im working on plotting the power spectral density of a random time series measured. I know the target spectrum.The idea is check the measurement vis-a-vis the target spectrum. However, I get slightly different plots for segment lengths of 128 &amp; 256, its noisy for higher segment lengths. For 128 its a closer match. For 256 its smooth, but there is a slight bulge in the spectrum at the top (when compared to the target). </p> <p>Im not sure which one to go with to validate the measuring device. Please advise.</p> <p>Edit : 1. Hand sketch of the look of the plot added for 256 point segment length. 2. For 128 point, its more or less an exact match.<a href="https://i.stack.imgur.com/ncAb9.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ncAb9.jpg" alt="PSD Hand Sketch"></a></p> https://dsp.stackexchange.com/q/49517 2 What are F0 counters in Speech signals? What is represented by F0? Tarun 007 https://dsp.stackexchange.com/users/36006 2018-05-29T05:43:04Z 2019-12-15T21:05:53Z <p>I can't find any dedicated definition for Frequency <strong>F0</strong> counters. Can anyone tell me what does <strong>F0</strong> exactly mean, I am confused about that.</p> https://dsp.stackexchange.com/q/47350 0 Uniqueness of Fourier Series Representation and the Fourier Transform of Periodic Signals user33568 https://dsp.stackexchange.com/users/0 2018-02-22T03:39:14Z 2019-12-16T04:04:35Z <p>If we are given a signal of the form $$x(t) = \sum_{k = -\infty}^{+\infty} a_k e^{j k \omega_0 t},$$ can we call it a Fourier Series representation of$x(t)$right away?</p> <p>Suppose we are given the signal$x(t) = e^{j2\Omega t} + e^{j4\Omega t}$, this signal can be expressed as $$x(t) = \sum_{k = -\infty}^{+\infty} a_k e^{jk\Omega t},$$ however, in this case,$2\Omega$is the fundamental frequency of the signal, not$\Omega$as the equation above might suggest.</p> <p>I ask this because in the second edition of Signals and Systems by Alan Oppenheim, he derives the Fourier transform of a periodic signal by considering the impulse train $$X(j\omega) = \sum_{k = -\infty}^{+\infty} 2\pi a_k\delta (\omega - k \omega_0)$$ and applying the inverse Fourier transform to obtain $$x(t) = \sum_{k = -\infty}^{+\infty} a_k e^{j k \omega_0 t},$$ which he says is the Fourier series representation of the signal without further discussion. But how do we know that in this case$\omega_0$is the fundamental frequency of the signal? Couldn't it be the case that it is a signal of the form given above, namely,$x(t) = e^{j2\omega_0 t} + e^{j4\omega_0 t}$, in which case the fundamental frequenct is$2\omega_0$? Thank you in advance.</p> https://dsp.stackexchange.com/q/47228 0 Causality as applied to capacitors user33568 https://dsp.stackexchange.com/users/0 2018-02-17T01:28:11Z 2019-12-16T03:04:00Z <p>This question stems from a point of confusion that I still have about the causality, linearity, and time-invariance in LCCDEs. I wanted to use the capacitor as an example. </p> <p>Consider a capacitor with capacitance$C$. Taking the current$i(t)$to be the input to the system and the voltage$v(t)$to be the output we have $$i(t) = C \frac{\mathrm{d} v(t)}{\mathrm{d}t}$$</p> <p>This differential equation can be solved to obtain $$v(t) = v(t_0) + \frac{1}{C} \int_{t_0}^{t} i(\tau) \mathrm{d} \tau$$</p> <p>My first question is: isn't this mathematically valid for all$t$? In other words, does this give us the response for all$t$or is it only valid for$t &gt; t_0$? If it is valid for all$t$, including the$t &lt; t_0$case, doesn't this make the system non-causal since it anticipates future input and output values? Are we allowed to integrate backwards in time?</p> <p>My second question relates to the assertion that a for the LCCDE to describe a linear system, the initial conditions must be zero. Suppose$t_0 = 0$such that $$v(t) = v(0) + \frac{1}{C} \int_{0}^{t} i(\tau) \mathrm{d} \tau$$</p> <p>With$v(0) = 0$the system is linear. But the choice of$t_0 = 0$is arbitrary, since for example $$v(t) = v(0) + \frac{1}{C} \int_{0}^{t} i(\tau) \mathrm{d} \tau = v(2) + \frac{1}{C} \int_{2}^{t} i(\tau) \mathrm{d} \tau$$</p> <p>Why shouldn't we require that$v(2) = 0$as well for that matter? What am I missing here? Thank you in advance.</p> https://dsp.stackexchange.com/q/47219 0 Wavelets and bank filters EWF https://dsp.stackexchange.com/users/24899 2018-02-16T13:06:44Z 2019-12-15T12:02:40Z <p>The wavelet transform has a problem as it gives poor time resolution for low frequencies and poor frequency resolution for high frequencies according to uncertainty conditions.</p> <p>This appears well while using the window notation. But when using bank filters, I can't imagine this problem. So, do bank filters solve this problem?</p> <p>In addition, if there is a signal with maximum frequency equal to 1000 hz, how are low and high pass filters designed to decompose the signal according to a certain mother wavelet?</p> https://dsp.stackexchange.com/q/44660 1 Intervals of convolution product Alena https://dsp.stackexchange.com/users/31543 2017-10-25T10:37:36Z 2019-12-15T13:01:20Z <p>Given are two Signals$x_1[n]$and$x_2[n]$.$x_1[n]$is in Intervall$[0,2]$different than null and$x_2[n]$is in Intervall$[0,3]$. The convolution product is Null outside intervals:$[0,6]$and$[-2,10]$. Can someone explain me why? I understand for 0,6 it's simply multiplication but why$[-2,10]$?</p> https://dsp.stackexchange.com/q/43932 0 Extract same in phase signal from 3 different sources with shared delayed noise? Victor Deleau https://dsp.stackexchange.com/users/27675 2017-09-25T19:54:18Z 2019-12-15T22:01:55Z <p>If I have 3 signals coming from 3 microphones with noise$n$delayed like this:</p> <p>$S_1(t) = x(t) + n(t+\phi_1)$</p> <p>$S_2(t) = x(t) + n(t+\phi_2)$</p> <p>$S_3(t) = x(t) + n(t+\phi_3)$</p> <p>Their shared feature$x(t)$is in phase and exactly the same.$x(t)$is a voice and the noise can be anything different from$x(t)$.</p> <p>EDIT 1: To be more precise, the different noises also share similar features but with different phases:</p> <p>$n_1(t) = \sum_{0 \to n} m_1(t+\tau_1) + m_2(t+\tau_2) + ... +m_n(t+\tau_n)n_2(t) = \sum_{0 \to n} m_1(t+\tau'_1) + m_2(t+\tau'_2) + ... +m_n(t+\tau'_n)$</p> <p>$etc$</p> <p>I approximately know what$x(t)$is, a voice call like "Hello Robot".</p> <p>How can I extract and detect$x(t)$from these three signals?</p> https://dsp.stackexchange.com/q/37247 0 How can one know the polynome equation based on the output of a system? hihaho https://dsp.stackexchange.com/users/26217 2017-01-28T13:04:30Z 2019-12-15T17:00:39Z <p>I came across this situation in my textbook: </p> <p><a href="https://i.stack.imgur.com/ya8fW.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ya8fW.jpg" alt="scan"></a></p> <p>However I have no clue about how you can (starting from the stepresponse on the left), get the polynome equation on the right.</p> <p>Could someone please explain?</p> <p>EDIT: what about this case? <a href="http://postimg.org/image/726noo2k3/b8bf257" rel="nofollow noreferrer">http://postimg.org/image/726noo2k3/b8bf257</a></p> https://dsp.stackexchange.com/q/34948 2 Detecting the rotation of digits in an image John Tan https://dsp.stackexchange.com/users/17228 2016-10-21T04:07:48Z 2019-12-15T12:27:50Z <p>I am trying to find the rotation of a given set of digits from the image. For example: <a href="https://i.stack.imgur.com/cXWA4.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/cXWA4.jpg" alt="enter image description here"></a></p> <p>There is no additional background information, only the digits are given in the input. </p> <p>I have tried using methods as described: <a href="https://stackoverflow.com/questions/3573574/ocr-rotated-image">1</a> , which uses the Tesseract library to solve for the rotation, but it does not work well in this case as there are no multiple lines (of text) involved in this scenario.</p> <p>For this purpose, it can be assumed that the decimal point and the "mm" are always present in the inputs. Are there any other methods or any additional features that I can exploit to solve this problem?</p> https://dsp.stackexchange.com/q/31222 4 Reliability of normalized cross-correlation with high lags G Pace https://dsp.stackexchange.com/users/21284 2016-06-01T15:52:45Z 2019-12-16T02:05:37Z <p>Say you have two signals with 100 data points in each signal. Then there are 20 time lags where the computation of the normalized cross-correlation between those signals only considers 10 or less pairs of data points. It seems like the normalized cross-correlation is less meaningful at these lags because it is computed from less data. My question is, is there a general way of accounting for the uncertainty introduced when we look at the correlation with higher lags? Or does that vary too much based on the context?</p> https://dsp.stackexchange.com/q/24517 2 Interpreting the FFT results of a structural vibration problem Chintan Pathak https://dsp.stackexchange.com/users/16494 2015-07-04T11:31:47Z 2019-12-15T19:02:40Z <p><strong>System:</strong> 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 <a href="http://www.pcb.com/Products.aspx?m=333B32" rel="nofollow noreferrer">here</a>. This accelerometer connects to a compatible FFT analyzer, make OROS-34, details <a href="http://www.oros.com/3890-or34-compact-analyzer.htm" rel="nofollow noreferrer">here</a>. </p> <p><strong>Results:</strong> Graph of response - acceleration v/s time</p> <p><img src="https://i.stack.imgur.com/M92w2.jpg" alt="Graph of response - acceleration v/s time "> </p> <p>Graph of FFT of above signal - acceleration v/s frequency</p> <p><img src="https://i.stack.imgur.com/xjHsg.jpg" alt="Graph of FFT of above signal - acceleration v/s frequency"> </p> <p><strong>Problem:</strong> 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. </p> <p>Can anyone suggest some reference for the theory above ? </p> <p>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. </p> <p>Better images: </p> <p>Graph of acceleration vs time for excitation freq of 15Hz with displacement amplitude of 50mm. <img src="https://i.stack.imgur.com/UITuB.jpg" alt="enter image description here"></p> <p>Graph of FFT of previous curve, i.e. acceleration vs freq <img src="https://i.stack.imgur.com/r3H0C.jpg" alt="enter image description here"></p> <p><em>The vertical red line in the image FFT image is a marker for reading X and Y coordinates at peak.</em> </p> <p>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. </p> <p>Promise: No more edits. :)</p> https://dsp.stackexchange.com/q/19562 0 Evaluation of incremental sensor user2366975 https://dsp.stackexchange.com/users/12029 2014-12-10T07:45:37Z 2019-12-16T00:02:10Z <p>Evaluating a volume flow incremental sensor does not deliver expected results.</p> <p>The pump of which the volume flow is to be measured has a hand-calculated flow rate of</p> <p>$$Q = \dfrac{n}{ 60 \;\mathrm{s/min}} e \pi\left(\frac{d}{2}\right)^2 \approx 2 \;\mathrm{cm^3/s}$$</p> <p>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}$.</p> <p>Now the sensor (VSE, Type: VS 0,1) delivers 10000 impulses per liter.</p> <p>The calculation counts the "Delta Impulses", call it dI, and divides by the time delta dt in milliseconds.</p> <p>$$\dfrac{dI}{dt} = \text{impulses/ms}$$</p> <p>Now I say that$10$impulses mean$1 \;\mathrm{cm^3}$as the spec says ($1 \;\mathrm{liter} = 1000 \;\mathrm{cm^3}$). So $$1 \;\text{impulse} = 0.1 \;\mathrm{cm^3/ms}$$</p> <p>Further with$1000 \;\mathrm{ms} = 1\;\mathrm{s}$, it is$100 \;\mathrm{cm^3/s}$. I can multiply the$\frac{dI}{dt}$with$100$and get the flow in$\mathrm{cm^3/s}$.</p> <p>$$1 \frac{dI}{dt} = 100 \;\mathrm{cm^3/s}$$ </p> <p>Is that correct?</p> <p>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).</p> <p>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?</p> https://dsp.stackexchange.com/q/16795 1 How to warp a pixel patch to another camera aledalgrande https://dsp.stackexchange.com/users/9120 2014-06-11T03:10:49Z 2019-12-15T23:00:55Z <p>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:</p> <p>$$T=T_2-T_1$$</p> <p>$$R=R_1^{T}R_2$$</p> <p>$$x' = \left[(x K_{inv} R) + T\right]\;K$$</p> <p>Where$R$and$T$are the transformation matrices between the cameras and$K$is the affine transformation matrix that describes the camera properties.</p> <p>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?</p> https://dsp.stackexchange.com/q/16538 5 1/3 Octave Analysis Alisson Vieira https://dsp.stackexchange.com/users/9034 2014-05-27T09:52:17Z 2019-12-15T18:01:25Z <p>Good Morning!</p> <p>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. </p> <p>I have done the following procedure by now:</p> <ol> <li><p>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: $$10\log_{10}\left( \dfrac{p^2}{p_0^2} \right)$$ 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.</p> <p><img src="https://i.stack.imgur.com/J5Rd6.png" alt="Amplitude (dBA) vs Time (s) of the impulsive noise generated by the device"></p></li> <li><p>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.</p> <p><img src="https://i.stack.imgur.com/9nM11.png" alt="1/3 Octave Bank Filter"></p></li> <li><p>Then, the program calculates the RMS value of the OUTPUT (after filtering). And this is the value that represents each frequency band.</p></li> <li><p>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}$.</p> <p><img src="https://i.stack.imgur.com/H09KM.png" alt="1/3 Octave Spectrum"></p></li> </ol> <p>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. 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.</p> <p>Does anybody know what I am doing wrong?</p> https://dsp.stackexchange.com/q/7846 5 How to choose FFT depth for ADC performance analysis (SINAD, ENOB) FriendFX https://dsp.stackexchange.com/users/3775 2013-02-14T06:01:20Z 2019-12-15T14:00:26Z <p>I am trying to simulate a model of an ADC and determine its performance. </p> <p>One of the interesting properties is the <a href="http://en.wikipedia.org/wiki/ENOB" rel="nofollow">ENOB (Effective Number Of Bits)</a>, which can be calculated from <a href="http://en.wikipedia.org/wiki/SINAD" rel="nofollow">SINAD (SIgnal-to-Noise And Distortion ratio)</a>.</p> <p>On that SINAD Wikipedia page, there is a <a href="http://www.analog.com/static/imported-files/tutorials/MT-003.pdf" rel="nofollow">PDF document</a> which suggests that the second definition on the SINAD Wikipedia page is the one to use and which I interpreted to be</p> <p>$$SINAD = 10 \log_{10} \left( \frac{p_f} {\sum_i{(p_i)} - p_0 - p_f} \right)dB$$</p> <p>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.</p> <p>That same document also defines $$ENOB = \frac{SINAD-1.76dB}{6.02}$$</p> <p>Using my SINAD and this ENOB definition, I compared the output of an ideal$N$bit ADC model, which matched for my FFT depth.</p> <p>In <a href="http://www.analog.com/static/imported-files/tutorials/MT-001.pdf" rel="nofollow">another (related) PDF document</a>, 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 $$10 \log_{10} \left( \frac{M}{2} \right)dB$$ <em>below</em> the theoretical signal-to-quantization-noise$SNR=6.02N+1.76dB$, which makes me wonder how$M$can thus ever be "too low"? </p> <p>While playing with different ADC models, I have seen that the ENOB <em>does</em> 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\$?</p>