Recent Questions - Signal Processing Stack Exchange most recent 30 from dsp.stackexchange.com 2023-03-21T23:37:15Z https://dsp.stackexchange.com/feeds https://creativecommons.org/licenses/by-sa/4.0/rdf https://dsp.stackexchange.com/q/87165 0 Inverse Z Transform to Partial Fraction Expansion HaRLoFei https://dsp.stackexchange.com/users/60430 2023-03-21T16:56:50Z 2023-03-21T16:56:50Z <p>I am solving a problem to find the zeros and poles. Subsequently, it is requires to determine the impulse response. Below is the system function:</p> <p><span class="math-container">$H(z)=\tfrac{z}{20z^2-4z+1}$</span></p> <p>I am able to compute the poles by quadratic factor: <span class="math-container">$z=\tfrac{-b \pm \sqrt{b^2-4ac}}{2a}$</span> <span class="math-container">$$=\tfrac{-(-4) \pm \sqrt{4^2-4(20)(1)}}{2(20)}$$</span> <span class="math-container">$$=\tfrac{1}{10} \pm \tfrac{1}{5}j$$</span> <span class="math-container">$$= 0.1 \pm 0.2j$$</span></p> <p>The poles are <span class="math-container">$p_{1,2}= 0.1 \pm 0.2j$</span></p> <p>However, I am stuck in the Inverse Z transform in order to determine the impulse. Below is my step:</p> <p><span class="math-container">$$H(z)=\tfrac{z}{(z-0.1-0.2j)(z-0.1+0.2j)} \cdot \tfrac{z^{-2}}{z^{-2}}$$</span> <span class="math-container">$$=\tfrac{z^{-1}}{(z^{-1}-0.1z^{-2}-0.2jz^{-2})(z^{-1}-0.1z^{-2}+0.2jz^{-2})}$$</span> <span class="math-container">$$=\tfrac{z^{-1}}{z^{-1}(1-0.1z^{-1}-0.2jz^{-1})z^{-1}(1-0.1z^{-1}+0.2jz^{-1})}$$</span> <span class="math-container">$$=\tfrac{1}{z^{-1}(1-0.1z^{-1}-0.2jz^{-1})(1-0.1z^{-1}+0.2jz^{-1})}$$</span> <span class="math-container">$$=\tfrac{1}{z^{-1}(1-z^{-1}(0.1+0.2j))(1-z^{-1}(0.1-0.2j))}$$</span></p> <p>Before I move to partial fraction expansion, may I know what can I do to the common factor <span class="math-container">$z^{-1}$</span> in the denominator? I think it will be a long operation if I substitute pole value in order to find value <span class="math-container">$A$</span> and <span class="math-container">$B$</span> in the partial fraction expansion.</p> https://dsp.stackexchange.com/q/87162 0 DCT - Measures of energy compaction gain achieved using DCT over FFT SakSath https://dsp.stackexchange.com/users/20260 2023-03-21T12:01:49Z 2023-03-21T17:36:47Z <p>The discrete cosine transform(DCT) is a popular choice for spectral analysis in audio, video, image compression algorithms. This is primarily due its efficient &quot;spectral compaction&quot; property in comparison with Fast Fourier Transform(FFT). Is there a way to measure approximate &quot;spectral compaction-gain&quot; (if its appropriate to term) - say &quot;X&quot; times - achieved by using DCT on data instead of FFT?</p> https://dsp.stackexchange.com/q/87160 0 Initial conditions of backward filter for forward-backward filtering on chunked real data in python GWSurfer https://dsp.stackexchange.com/users/40456 2023-03-21T10:10:29Z 2023-03-21T10:10:29Z <p>I have to apply a downsampling filter on a realtime data stream (<em>signal</em>) and I want to do it in python. The data is sampled at 16 kHz and loaded in a loop in chunks of 1 second. I have to downsample the data with the following:</p> <ol> <li>Forward-backward filter for downsampling to preserve phase (<strong>zero-phase filter</strong>).</li> <li>Downsample in &quot;real-time&quot; (i.e. one second at a time) from 16 kHz to 2 kHz.</li> </ol> <p>I've tried to use <code>Scipy.signal.butter</code> to output <em>b</em> and <em>a</em> and pass them to <code>Scipy.signal.lfilter</code>. I'm having issues at the edges between two 1 second chunks, in the form of a <strong>transient</strong>. <code>Scipy.signal.filtfilt</code> does not solve the issue. I suspect the problem is with the initial conditions of the backward filter <strong>zi_back</strong>, but I am not sure. I have tried initializing them at rest and then passing <strong>zi_back</strong> and <strong>zi_forw</strong> this way:</p> <p><code>firstpass, zi_forw = signal.lfilter(b, a, signal, zi_forw)</code></p> <p><code>signal_downsampled, zi_back = signal.lfilter(b, a, firstpass[::-1], zi_back)[::-1] </code></p> <p>I don't mind the transient on the first chunk (~0sec), but the ones at 1sec, 2sec, 3sec, 4sec and so on are an issue.</p> <p>How can I implement this near real time forward-backward filter without encountering this transient?</p> https://dsp.stackexchange.com/q/87159 2 How do noise-canceling headphones cancel out white noise, which is unpredictable in nature? mdatsev https://dsp.stackexchange.com/users/67042 2023-03-21T03:43:35Z 2023-03-21T11:49:19Z <p>From what I know noise-canceling headphones generate sound waves that are 180° out of phase with the ambient noise. I understand that they are not effective at canceling out sudden and unpredictable sounds, such as a car horn or a dog barking, because there isn't enough time for them to process the sound and generate the phase-inverted wave, and they are generally good at canceling out periodic sounds because it's easier to predict the sound wave and generate the inverted wave on time. What is confusing to me, however, is that they are also very effective in canceling out white noise, which is by definition random and unpredictable. Some sources say that this is because it is sustained and has a well-defined frequency spectrum. But that doesn't make sense to me because even if we perfectly know the frequencies if the phase is random there would be no way to generate the inverted wave, unless it's done instantaneously, which would make them able to cancel out any kind of sudden sound. What am I missing here?</p> https://dsp.stackexchange.com/q/87157 1 How do n_fft and win_length determine the window in spectrogram? esh3390 https://dsp.stackexchange.com/users/67041 2023-03-21T02:56:41Z 2023-03-21T19:38:12Z <p>I am currently trying to understand <code>librosa.feature.melspectrogram</code> in a mathematical sense.</p> <p>In my understanding, spectrogram is based on the STFT which is for a given discrete time sequence <span class="math-container">$x[n]$</span> of length <span class="math-container">$L$</span>, the value corresponding to a frame of <span class="math-container">$x[n]$</span> at time index <span class="math-container">$m$</span> and frequency index <span class="math-container">$k$</span> is</p> <p><span class="math-container">$$X_m[k] = \sum_{n=0}^{N-1} x[n+mH]w[n] \ e^{-j2\pi kn/N}$$</span> where <span class="math-container">$$x_m[n] = x[n+mH]w[n]$$</span></p> <p>and <span class="math-container">$\frac{N}{2}$</span> corresponds to <code>n_fft</code> and <span class="math-container">$H$</span> corresponds to <code>hop_length</code>.</p> <p>Also, the Hann window <span class="math-container">$w[n]$</span> of length <span class="math-container">$L$</span> is</p> <p><span class="math-container">$$w[n]=\sin^2 \left( \frac{2\pi n}{L-1} \right)$$</span></p> <p>for <span class="math-container">$0 \leq n \leq L-1$</span></p> <p>However, <code>n_fft</code> and <code>win_length</code> do not have to be equal but just needs to satisfy <code>win_length &lt;= n_fft</code> and then the window will be zero-padded to match the <code>n_ftt</code>.</p> <p>Does this means that the actual Hann window will become</p> <p><span class="math-container">$$w[n]=\begin{cases} \sin^2 \left(\frac{2\pi n}{L-1} \right), \qquad &amp; 0 \leq n \leq L-1\\ \\ 0, \qquad &amp; L \leq n \leq N-1\\ \end{cases}$$</span></p> <p>or something like this with being centered to <span class="math-container">$\frac{N}{2}$</span>?</p> <p>Sorry if this is the duplicated question but I could not find a satisfying answer.</p> https://dsp.stackexchange.com/q/87155 0 I lose 150 points. Can the system return it back to me? [migrated] Wei-Cheng Liu https://dsp.stackexchange.com/users/24039 2023-03-21T01:24:14Z 2023-03-21T01:24:14Z <p>I am sorry that I may ask a question in the wrong place. But I do not know where to ask my question. Recently, I set a bounty of 150 points to my question <a href="https://dsp.stackexchange.com/questions/87011/a-problem-about-sqnr-pcm-dpcm-and-dm">A problem about SQNR, PCM, DPCM, and DM</a>. After seven days, no one answer this question. And then, I lose the 150 points. Can the system return these 150 points to me? Thank you very much.</p> <p>Note: I also want to apologize for my awful English writing ability because English is not my mother language.</p> https://dsp.stackexchange.com/q/87153 0 Poor Attenuation With High Pass Filter expr_champ2 https://dsp.stackexchange.com/users/67040 2023-03-21T00:43:12Z 2023-03-21T02:13:41Z <p>I am having issues with my implementation of a FIR high pass filter. The low pass filter has an acceptable level of attenuation in the stopband, but the high pass filter has poor attenuation in the stopband. I have not seen any mention of this occurring in the sources that I read and I am unsure why this is occurring.</p> <p>I am referencing <em>The Scientist and Engineer's Guide to Digital Signal Processing</em> (Page 271 regarding LPF to HPF). I am using white noise to test the frequency response of the filters, and the attached image is from an external program. Here is the relevant part of my code (just audio boilerplate has been removed):</p> <pre class="lang-cpp prettyprint-override"><code> constexpr int rate = 44100; std::random_device rd; std::mt19937 gen(rd()); std::uniform_real_distribution&lt;float&gt; distrib(-1.0f, 1.0f); constexpr int buf_len = rate * 3; float* in = new float[buf_len]; float* out = new float[buf_len](); constexpr int M = 200; float fc = 2100.0f / rate; double h[M + 1]{0.0f}; for (int i = 0; i &lt; buf_len; i++) { in[i] = distrib(gen); } for (int i = 0; i &lt;= M; i++) { if ((i - M/2) == 0) { h[i] = 2*M_PI*fc; } else { h[i] = std::sin(2.0*M_PI*fc*(i - M/2)) / (i - M/2); } h[i] *= 0.42 - 0.5 * std::cos((2.0*M_PI*i)/M) + 0.08 * std::cos((4.0*M_PI*i)/M); } double sum = 0; for (int i = 0; i &lt;= M; i++) { sum += h[i]; } for (int i = 0; i &lt;= M; i++) { h[i] /= sum; } //change to high pass for (int i = 0; i &lt;= M; i++) { h[i] *= -1.0; } h[M/2] += 1.0f; // Convolve for (int i = M; i &lt; buf_len; i++) { for (int j = 0; j &lt;= M; j++) { out[i] += in[i - j] * h[j]; } } </code></pre> <p><a href="https://i.stack.imgur.com/J7h86.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/J7h86.png" alt="frequency responses of the filters " /></a></p> https://dsp.stackexchange.com/q/87152 0 Ambiguity function information cooldanietje https://dsp.stackexchange.com/users/67038 2023-03-20T19:09:40Z 2023-03-20T19:09:40Z <p>For a course that i'm taking im asked a question about the ambiguity function of a FMCW radar. However i have not found a good source for reading about this so don't quite understand it.</p> <p>I get given the following cuts:</p> <p><a href="https://i.stack.imgur.com/csDjI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/csDjI.png" alt="Doppler and delay cut of the ambiguity function" /></a></p> <p>I understand it in the following way: If there are 2 targets, i cannot distinguish between them if they have a delay larger than +- 0.2 us or +- 20 kHz doppler shift?</p> <p>Do these cuts also say something about the waveform? Would for instance the width (ie from -0.2us to 0.2us = 0.4 us) be equal to 1 / B, the bandwidth of the FMCW radar? And for the other cut would the width (-20 to 20 kHz = 40 kHz) then be the 1/T, the pulse time? thus resulting in ~2.5MHz bandwidth and 25 us pulse width?</p> <p>I tried recreating these cuts in matlab but didnt have any success in doing so so far. Any good sources for reading about it would also be appreciated !</p> <p>Thank you :)</p> https://dsp.stackexchange.com/q/87150 0 Transfer function $h(t)$ of a positive feedback system O-Negative https://dsp.stackexchange.com/users/67031 2023-03-20T09:09:11Z 2023-03-20T11:21:37Z <p>I want to find the transfer function h(t) of the below positive feedback system. I came out till this.</p> <p><a href="https://i.stack.imgur.com/YZPQ5.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YZPQ5.png" alt="enter image description here" /></a></p> <p>How can i get the inverse laplace of this function? say β = 1 and γ = 1</p> <p><a href="https://i.stack.imgur.com/iAcyt.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/iAcyt.png" alt="enter image description here" /></a></p> https://dsp.stackexchange.com/q/87149 0 How to calculate signal to noise ratio (SNR) from a list (sequence) of amplitude? Muhammad Ikhwan Perwira https://dsp.stackexchange.com/users/67030 2023-03-20T08:50:58Z 2023-03-20T13:11:24Z <p>Suppose I have a list of amplitude (straight line signal):</p> <pre><code>x = [1,1,1,0,1,1,1,1] </code></pre> <p>By intuition, zero value in list x makes the noise of straight signal.</p> <p>If we modified some value, such as 2, we get more noise level.</p> <pre><code>y = [1,1,1,0,1,2,1,1] </code></pre> <p>Hence by my intuition, SNR of list x is greater than SNR of list y.</p> <p>So how do I calculate SNR from a list?</p> <p>I know that formula of SNR basically if signal amplitude is voltage.</p> <pre><code>SNR = 20*log(S_i/N_i) </code></pre> <p>Where <code>S_i</code> is value of a list signal in an index.</p> <p>But I have no idea how to get <code>N_i</code>.</p> <p>Assume we are using volt unit.</p> <p>I expect I can compute SNR programmatically from scratch without any external library with python.</p> https://dsp.stackexchange.com/q/87147 0 Symbol timing synchronization with delay Xiang Li https://dsp.stackexchange.com/users/66756 2023-03-20T05:10:04Z 2023-03-20T05:10:04Z <p>I’m trying to simulate a TLL loop using Gardner TED. I set symbol rate is 1000 and 8 samples for 1 symbol. First I use Root-raised-cosine filter to shape the symbols, then I use interp1 in matlab to resample the signal to add sampling delay. And then I feed the signal to the match filter, then I downsample the signal to four points for 1 symbol in that the interpolator needs 4 points as input, then I downsample these 4 points to 2 points because the TED only needs two samples for 1 symbol, after this I send the matched signal to the loop. I didn’t drop the filter delay because I use it as what happens in the real world, that is, we don’t know when the symbol starts. It works fine at first the fractional interval converges to a value, but when I change the number of delay before the signal it won’t converge. For instance, if I increase or decrease the number of random value before the signal, the loop won’t be stable. <a href="https://i.stack.imgur.com/87r5q.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/87r5q.jpg" alt="enter image description here" /></a> When it converges <a href="https://i.stack.imgur.com/MmFbh.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MmFbh.jpg" alt="enter image description here" /></a> When it doesn’t converge <a href="https://i.stack.imgur.com/LmEuR.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/LmEuR.jpg" alt="enter image description here" /></a> Should I add a frame synchronization unit before TED? I think the structure of RX would be match filter then symbol timing synchronization next carrier recovery and finally be the frame synchronization.</p> https://dsp.stackexchange.com/q/87145 3 Inverting transformation $\displaystyle m(t)=\sum_{i=1}^d x(i)^t$ Yaroslav Bulatov https://dsp.stackexchange.com/users/63461 2023-03-19T23:48:42Z 2023-03-20T00:28:08Z <p>Suppose there's a vector of <span class="math-container">$d$</span> of positive numbers <span class="math-container">$x(1),\ldots,x(d)$</span> which I need to obtain from a vector of <span class="math-container">$d$</span> derived quantities <span class="math-container">$m(t_1),\ldots,m(t_d)$</span> where <span class="math-container">$\{t_i\}$</span> is some conveniently chosen vector of real numbers and</p> <p><span class="math-container">$$m(t)=\sum_{i=1}^d x(i)^t$$</span></p> <p>Is there a practical way to obtain <span class="math-container">$x$</span> from <span class="math-container">$m$</span>? For instance, suppose <span class="math-container">$x=(1,\frac{1}{2},\frac{1}{3},\ldots,\frac{1}{1000})$</span>.</p> <p>There's related discussion <a href="https://math.stackexchange.com/a/4662459/998">here</a> which suggests there isn't, which seems unexpected because if we had integrals in place of sums, we could use the inverse Laplace transform.</p> https://dsp.stackexchange.com/q/87144 1 Does the Kramer-Kronig relations apply to this example $f(t) =\left(1-t^2\right)^4\cdot\theta(1-t^2)$? Joako https://dsp.stackexchange.com/users/59590 2023-03-19T21:02:02Z 2023-03-21T20:44:40Z <p>Does the <a href="https://en.m.wikipedia.org/wiki/Kramers%E2%80%93Kronig_relations" rel="nofollow noreferrer">Kramer-Kronig relations</a> apply to this example <span class="math-container">$f(t) =\left(1-t^2\right)^4\cdot\theta(1-t^2)$</span>?</p> <p>with <span class="math-container">$\theta(t)$</span> is the <a href="https://en.wikipedia.org/wiki/Heaviside_step_function" rel="nofollow noreferrer">Heaviside step function</a>.</p> <p>I made a detailed related question <a href="https://math.stackexchange.com/q/4596824/909869">here</a> with full explanations, where I got no answers, but the main doubt could be solved just by knowing if the <a href="https://en.m.wikipedia.org/wiki/Kramers%E2%80%93Kronig_relations" rel="nofollow noreferrer">KK-relation conditions</a> are fulfilled or not by this example.</p> https://dsp.stackexchange.com/q/87140 0 The benefit of Eigendecomposition of DCT and DST ABB https://dsp.stackexchange.com/users/50574 2023-03-19T18:20:49Z 2023-03-19T20:54:16Z <p>I am Ph.D in pure mathematics and interested in signal processing.</p> <p>Theoretically, any illustration of the eigendecomposition of the discrete trigonometric transforms (DTTs) is worthwhile.</p> <p>Q. What real applications can be followed by having the eigendecomposition of the discrete sine and cosine transforms? Any reference is appreciated.</p> https://dsp.stackexchange.com/q/87139 -2 Matlab command "iztrans"only applicable for causal signals? [closed] engr https://dsp.stackexchange.com/users/39794 2023-03-19T18:09:29Z 2023-03-20T03:14:37Z <p>Matlab command for inverse z transform <code>iztrans</code>only applicable for causal signals? or also valid for non causal signals?</p> <p>Actually i want to find inverse z transform for the cases shown in attached snap and i am confused if iztrans command is applicable to all of them? <a href="https://i.stack.imgur.com/ENQqg.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ENQqg.jpg" alt="enter image description here" /></a></p> https://dsp.stackexchange.com/q/87138 0 Periodic peaks in power spectrum doubleE https://dsp.stackexchange.com/users/850 2023-03-19T17:41:34Z 2023-03-19T17:41:34Z <p>I have a noisy(blue) and clean(red) signal. I have windowed them by a hanging window and used Matlab pspectrum() to plot their power spectrum.</p> <p>I see a periodic peak at noisy(blue) one which is spaced around 1.8Hz. How should I interpret this periodic peaks? Signal is sampled at 130Hz.</p> <p><a href="https://i.stack.imgur.com/zFflF.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zFflF.jpg" alt="enter image description here" /></a></p> https://dsp.stackexchange.com/q/87135 0 Convolution of two functions using FFTW gebegb https://dsp.stackexchange.com/users/67020 2023-03-19T12:00:52Z 2023-03-19T16:08:50Z <p>I'm trying to perform a discrete convolution of two functions, <span class="math-container">$f(x) = 1$</span> and <span class="math-container">$g(x) = \exp(-x)$</span> of length <code>nsize</code> using FFTW. I have followed the procedure for zero-padding my data from <a href="https://dsp.stackexchange.com/questions/22145/perform-convolution-in-frequency-domain-using-fftw">here</a>. My resulting values are qualitatively similar, but the magnitudes are way off from the expected result. I have attached the code I have written for reference.</p> <pre><code>#include &lt;iostream&gt; #include &lt;cmath&gt; #include &lt;fstream&gt; #include &quot;fftw3.h&quot; int main() { /* Size of initial arrays (f(x) and g(x)) arrays */ const int nsize = 100; /* Size of the convoluted array (size(f(x)) + size(g(x)) - 1) */ const int zero_padded_size = 2*nsize - 1; /* Declaration of the functions */ double f[zero_padded_size] = {}; double g[zero_padded_size] = {}; /* Initialization of f(x) and g(x), with zero-padding beyond their size */ for(int i = 0; i &lt; nsize; i++) { f[i] = 1.0; g[i] = exp(-2.*M_PI*i/nsize); } /* Declaration and memory allocation of complex array to store the fourier transforms of f(x) and g(x) */ fftw_complex *F; fftw_complex *G; F = (fftw_complex *) fftw_malloc(sizeof(fftw_complex)*zero_padded_size); G = (fftw_complex *) fftw_malloc(sizeof(fftw_complex)*zero_padded_size); /* FFTW plans to convert f(x) and g(x) to their fourier domain functions */ fftw_plan realfToFourierF = fftw_plan_dft_r2c_1d(zero_padded_size, f, F, FFTW_ESTIMATE); fftw_plan realgToFourierG = fftw_plan_dft_r2c_1d(zero_padded_size, g, G, FFTW_ESTIMATE); fftw_execute(realfToFourierF); fftw_execute(realgToFourierG); /* Declaration of complex array to store fourier-space multiplication of F[f(x)] and F[g(x)] */ fftw_complex *H; H = (fftw_complex *) fftw_malloc(sizeof(fftw_complex)*zero_padded_size); /* Point-wise multiplication of F[f(x)] and F[g(x)] */ for(int i = 0; i &lt; zero_padded_size; i++) { H[i] = (F[i] * G[i] - F[i] * G[i]); H[i] = (F[i] * G[i] + F[i] * G[i]); } /* Array declaration for real-space values after Inverse FT of F[h(x)] = F[f(x)]*F[g(x)] */ double h[zero_padded_size] = {}; /* FFTW plan for IFT of F[h(x)] to h(x) */ fftw_plan fourierHToRealh = fftw_plan_dft_c2r_1d(zero_padded_size, H, h, FFTW_ESTIMATE); fftw_execute(fourierHToRealh); /* Normalization factor */ double normFactor = 1./zero_padded_size; std::ofstream fileout(&quot;./convolve.dat&quot;); for(int i = 0; i &lt; zero_padded_size; i++) { h[i] *= normFactor; double t = 2.*M_PI*i/nsize; fileout&lt;&lt;i&lt;&lt;&quot;\t&quot;&lt;&lt;t&lt;&lt;&quot;\t&quot;&lt;&lt;f[i]&lt;&lt;&quot;\t&quot;&lt;&lt;g[i]&lt;&lt;&quot;\t&quot;&lt;&lt;h[i]&lt;&lt;&quot;\t&quot;&lt;&lt;(1.0 - exp(-t))&lt;&lt;std::endl; } fileout.close(); } </code></pre> <p>I have attached the result obtained from the FFTW convolution against the expected result, and they differ by a constant factor (someConstantFactor) of 32.681202913.</p> <p><a href="https://i.stack.imgur.com/qoly7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qoly7.png" alt="Result from the convolution using FFTW normalized by a constant factor compared with the expected result. Here someConstantFactor = 32.681202913" /></a></p> <p>I would be grateful if someone can provide any suggestions as to why this difference occurs and what I'm doing wrong. Thanks!</p> https://dsp.stackexchange.com/q/87132 14 How can I build something, like actual implementations of all these things I am learning in signal processing? Koustubh Jain https://dsp.stackexchange.com/users/67018 2023-03-19T05:51:02Z 2023-03-21T17:33:48Z <p>I am an undergraduate electronics engineering student taking a signal processing course this semester.</p> <p>I have learned a lot of theoretical things in my lectures, such as how to shift or fold a signal, how to convolve 2 signals, how to take their Laplace or Z or Fourier transforms, but I want to build something useful in real life using all these concepts. All we do in our lab is just write simple programs in MATLAB to do these computations.</p> <p>I found out that effect pedals used for instruments such as guitars are basically signal processors. How and where can I learn to build something practical from all this theory I am learning in my signal processing classes?</p> <p>It is not just signal processing, but other classes too. Sometimes I feel like in electronics engineering all we do is learn theory and never build anything in real life. Like CS students can build actual stuff in software but we can't.</p> <p>Can anyone tell me how can I build actual stuff from all the courses I am taking in electronics engineering? Do I need to learn how to use an Arduino or a Raspberry Pi for that?</p> https://dsp.stackexchange.com/q/87131 0 Frequency Shift Keying Gotz2bril https://dsp.stackexchange.com/users/66382 2023-03-19T04:51:47Z 2023-03-19T04:51:47Z <p>The following signal is an example of frequency shift keying. Let the pulse rate be 100 bits/sec. If f1 = 1324 hz what should f2 be for the two tones to be orthogonal?</p> <p><a href="https://i.stack.imgur.com/cvrJ8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/cvrJ8.png" alt="enter image description here" /></a></p> <p>I know that the formula to solve this is delta F = 1/2T, and I am given f1....what I am not understanding is what is T? Is it 1/pulse rate, which is 100 bits/sec?</p> https://dsp.stackexchange.com/q/87130 0 Using Reed-Solomon with hard decisions, how can I determine when the error-correction capability is exceeded Glarp https://dsp.stackexchange.com/users/67015 2023-03-19T01:01:22Z 2023-03-20T01:33:23Z <p>I'm creating a RS(15,9) code and can't figure out how to determine when T&gt;t (T&gt;3) by using the syndrome components. I understand that to determine the error count you use the largest TxT matrix whose determinant is NOT equal to zero. However, by this logic, the only way to determine if T&gt;3 would be to calculate the determinant of a 15x15 matrix, then 14x14, then 13x13, etc. Is there any better way to do this?</p> <p>When I run my current code with a certain set of 4 errors, it triggers the T=2 errors condition, and actually attempts to correct errors in the wrong position (making the decoded message even more incorrect).</p> <p>Here is my current Verilog code used to determine error count. Thank you in advance for any help</p> <pre><code> det = multiply(syndromeComponent,syndromeComponent) ^ multiply(syndromeComponent,syndromeComponent); // Represents det3,4 det = multiply(syndromeComponent,syndromeComponent) ^ multiply(syndromeComponent,syndromeComponent); // Represents det2,4 det = multiply(syndromeComponent,syndromeComponent) ^ multiply(syndromeComponent,syndromeComponent); // Represents det2,3 det = multiply(syndromeComponent,det) ^ multiply(syndromeComponent,det) ^ multiply(syndromeComponent,det); //Represents det1,2,3 if((syndromeComponent || syndromeComponent || syndromeComponent || syndromeComponent || syndromeComponent || syndromeComponent) == 0) begin T = 0; end else begin i = 0; while(i == 0) begin if(det != 0) begin T = 3; i = 1; end else if(det != 0) begin T = 2; i = 1; end else if((divide(syndromeComponent,syndromeComponent)==divide(syndromeComponent,syndromeComponent)) &amp;&amp; (divide(syndromeComponent,syndromeComponent)==divide(syndromeComponent,syndromeComponent)) &amp;&amp; (divide(syndromeComponent,syndromeComponent)==divide(syndromeComponent,syndromeComponent)) &amp;&amp; (divide(syndromeComponent,syndromeComponent)==divide(syndromeComponent,syndromeComponent)) &amp;&amp; (divide(syndromeComponent,syndromeComponent)==divide(syndromeComponent,syndromeComponent))) begin T = 1; i = 1; end end end end <span class="math-container">`</span> </code></pre> https://dsp.stackexchange.com/q/87124 0 Notch Digital Filter LianNuo https://dsp.stackexchange.com/users/67011 2023-03-18T16:53:17Z 2023-03-20T08:05:59Z <p>I am given a notch digital filter with the <span class="math-container">$z$</span>-transform being: <span class="math-container">$$W(z)=MF(z)F(z^{*})^{*}=M\frac{z-q}{z-p}\frac{z-q^{*}}{z-p^{*}}$$</span> where <span class="math-container">$M$</span> is the normalisation factor, <span class="math-container">$q=e^{-i2\pi\frac{f_0}{f_s}}$</span>, <span class="math-container">$p=(1-\epsilon)q$</span> and <span class="math-container">$0&lt; \epsilon \ll 1$</span>. It is easy to see the zeros of this system are on the unit circle while the poles are inside the unit circle.</p> <p>But how do we determine its stability? I think we must know whether this system is causal or anti-causal. I am very new to this subject so please be clear.</p> https://dsp.stackexchange.com/q/87123 0 How to calculate to power of a uniformly distributed noise? Ole https://dsp.stackexchange.com/users/66505 2023-03-18T16:40:10Z 2023-03-19T16:56:56Z <p>I was wondering how I would calculate the power of a noise, if I have a uniformly distributed white noise between <span class="math-container">$-\frac{q}{2}$</span> and <span class="math-container">$\frac{q}{2}$</span>? My approach was to use the formula</p> <p><span class="math-container">$$\int\limits_{-\frac{q}{2}}^{\frac{q}{2}} x^2 \ \frac{1}{q} \ \mathrm{d}x = \frac{q^2}{12}$$</span></p> <p>But I'm not sure if that is right. Or do I need to use the autocorrelation function, which I think should be <span class="math-container">$R_{XX}(\tau) = \frac{1}{q^2} \delta(\tau)$</span>, to calculate the power spectral density function <span class="math-container">$S_X(f) = \frac{1}{q^2}$</span>? I'm just confused about the exact definition of power here.</p> https://dsp.stackexchange.com/q/87120 0 Subsampling in frequency domain? Effect of sampling rate on spectrum? OverLordGoldDragon https://dsp.stackexchange.com/users/50076 2023-03-18T15:45:48Z 2023-03-19T12:52:19Z <p>Given a sequence</p> <p><span class="math-container">$$x[n] = [0, 1, 2, 3, 4, 5, 6, 7]$$</span></p> <p>and its subsampling (by e.g. factor of 2)</p> <p><span class="math-container">$$x_\text{sub}[n] = [0, 2, 4, 6]$$</span></p> <p>are <span class="math-container">$x_\text{sub}$</span> and <span class="math-container">$x$</span> related in spectrum? That is, given <span class="math-container">$X = \texttt{DFT}(x)$</span>, is there an operation <span class="math-container">$\text{op}$</span> such that <span class="math-container">$x_\text{sub} = \text{op}(X)$</span>? Can it also be described in continuous-time, or in terms of sampling rate? A visual demonstration would be nice.</p> <p>If there is such a method, are there practical applications?</p> https://dsp.stackexchange.com/q/87089 2 Correct Windowing Effect at Amplitude Scale John L https://dsp.stackexchange.com/users/66958 2023-03-16T18:25:56Z 2023-03-19T17:00:38Z <p>I am trying verify the noise floor returned by Matlab <code>sinad()</code>. I am able to get the results matching by summing power spectrum density with <span class="math-container">$\frac{f_\text{s}}{N}$</span>. But I am not able to match the results by following Parseval's theorem to root sum square the <span class="math-container">$X[k]$</span>.</p> <p><span class="math-container">$$S_1=\sum_{n=0}^{N-1} \big|w[n]\big|$$</span> <span class="math-container">$$S_2=\sum_{n=0}^{N-1} \big|w[n]^2\big|$$</span></p> <p>where <span class="math-container">$w[n]$</span> is a window function.</p> <p><span class="math-container">$$\sum_{n=0}^{N-1} \big|x[n]\big|^2 = \frac{1}{S_1}\sum_{k=0}^{N-1}\big|X[k]\big|^2$$</span></p> <p>My thought was to apply windows DC gain correction at <span class="math-container">$X[k]$</span> amplitude scale (not power scale). This relation works if the windowing function is Uniform, so obviously I am missing something.</p> <p>Thanks to @Dan Boschen and @OverLordGoldDragon, I realized there are two errors:</p> <ol> <li>Because this is non-coherent signals, the correction factor is <span class="math-container">$S_2$</span> rather than <span class="math-container">$S_1$</span>. And correction is applied to power not amplitude.</li> <li>The dividing factor should still be <span class="math-container">$frac{1}{N}$</span>. Correction made within the summing operation.</li> </ol> <p>Therefore the Parseval's equation becomes: <span class="math-container">$$\sum_{n=0}^{N-1} \big|x[n]\big|^2 = \frac{1}{N}\sum_{k=0}^{N-1}\frac{X[k]^2}{S_2}$$</span></p> <p>Here is revised test code. All results match.</p> <pre><code>rng(1) fs = 500; % sampling frequency T = 1000; t = 0:1/fs:T-1/fs; Fs = 100; % natural frequency data = cos(2*pi*Fs*t) + 0.011*randn(size(t)); N = length(data); F=fs*(0:(N/2))/N; % Kaiser window used by sinad(), beta=38 win = kaiser(N,38); data_fft_full_abs_k=abs(fft(win.*data')); data_fft_full_abs_k = data_fft_full_abs_k(1:N/2+1); S1=sum(win); S2=sum(win.^2); ENBW_hz=fs*S2/(S1^2); % find the range of signal spectrum [peak_fft,peak_freq_idx]=max(data_fft_full_abs_k); idxLeft = peak_freq_idx-1; idxRight = peak_freq_idx+1; while idxLeft &gt; 0 &amp;&amp; data_fft_full_abs_k(idxLeft) &lt;= data_fft_full_abs_k(idxLeft+1) idxLeft = idxLeft - 1; end while idxRight &lt; N &amp;&amp; data_fft_full_abs_k(idxRight-1) &gt;= data_fft_full_abs_k(idxRight) idxRight = idxRight + 1; end idxLeft = idxLeft + 1; idxRight = idxRight - 1; % remove the signals data_fft_full_abs_k(idxLeft:idxRight)=0; % calculate rms with amplitude correction % revert to double sided before calculating root sum square data_fft_full_abs_k=vertcat(data_fft_full_abs_k,data_fft_full_abs_k(2:length(data_fft_full_abs_k)-1)); noise_fft_rss=rssq(sqrt(data_fft_full_abs_k.^2/S2))/sqrt(N) % calculate rms with correct at psd data_fft_full_power=data_fft_full_abs_k.^2; data_fft_power=(2/S1^2)*data_fft_full_power(1:N/2+1); data_fft_psd=data_fft_power./ENBW_hz; % 2/(fs*S2)*data_fft_power noise_psd=sqrt(sum(data_fft_psd*fs/N)) % calculate rms with sinad() [snrad_dB,dist_noise_pw_dB]=sinad(data,fs); noise_floor_rms_sinad=sqrt(10^(dist_noise_pw_dB/10)) </code></pre> https://dsp.stackexchange.com/q/87011 3 A problem about SQNR, PCM, DPCM, and DM Wei-Cheng Liu https://dsp.stackexchange.com/users/24039 2023-03-10T09:24:47Z 2023-03-21T15:05:17Z <blockquote> <p>A baseband analog message signal <span class="math-container">$x(t)$</span> with bandwidth 20 kHz, power <span class="math-container">$10^{-3}$</span>, and <span class="math-container">$|x(t)| \leq 1$</span> is waveform encoded and transmitted through a channel of bandwidth 160 kHz. Besides, let the sampled data of <span class="math-container">$x(t)$</span> be denoted by <span class="math-container">$x_n$</span> and suppose that <span class="math-container">$$| x_n - x_{n-1}| &gt; \leq 10^{-0.55 f_s / f_N},$$</span> where <span class="math-container">$f_s$</span> denotes the sampling rate and <span class="math-container">$f_N$</span> denotes the Nyquist rate, for all <span class="math-container">$n$</span> when <span class="math-container">$f_s \geq f_N$</span>. If we require SQNR <span class="math-container">$\geq$</span> 30 dB, please answer the followng questions.</p> <p>(a) Determine the maximum bit rate, <span class="math-container">$R_{b\_max}$</span>, of the coded binary data.</p> <p>(b) If PCM was used for encoding, determine the range of bits, <span class="math-container">$v_{PCM}$</span>, can be so that SQNR required is fullfilled.</p> <p>(c) If DPCM was used for encoding, determine the range of bits, <span class="math-container">$v_{DPCM}$</span>, can be so that SQNR required is fulfilled according to <span class="math-container">$R_{b\_max}$</span> determined in (a).</p> <p>(d) Determine the condition of <span class="math-container">$f_s$</span> so that DM could fulfill the SQNR required according to <span class="math-container">$R_{b\_max}$</span> determined in (a).</p> <p>(e) According to the above results, determine which encoding method(s), among PCM, DPCM, and DM, can be suitable to transmit through the channel.</p> </blockquote> <hr> <p>The following is my attempt to solve the above questions:</p> <p>(a) According to the Shannon capacity formula, the maximum bit rate is the channel capacity: <span class="math-container">$$R_{b_\max} = C = W \log_2 (1 + SQNR) = 160 \times 10^3 \times \log_2(1 + 10^{30/10}) \approx 1.5948 \times 10^6 \text{ bits/s}.$$</span></p> <p>(b) From Eq. (7.4.4) in  we know that <span class="math-container">$$\left. \text{SQNR} \right|_{\text{dB}} \approx 10 \log_{10} \frac{P_X}{x^2_{\max}} + 6 v_{PCM} + 4.8,$$</span> where <span class="math-container">$P_X$</span> is the power in each sample and <span class="math-container">$x_{\max}$</span> is the maximum possible value for <span class="math-container">$x(t)$</span>. Now <span class="math-container">$P_X = 10^{-3}$</span> and <span class="math-container">$x_{\max} = 1$</span>, so <span class="math-container">$$10 \log_{10} \frac{10^{-3}}{1^2} + 6 v_{PCM} + 4.8 \geq 30.$$</span> Solving the above equation, we get <span class="math-container">$$v_{PCM} \geq \frac{46}{5} = 9.2 \text{ bits}.$$</span> Because the number of bits must be a positive integer, the range of bits is <span class="math-container">$$v_{PCM} \geq 10 \text{ bits}.$$</span></p> <p>(c) The Nyquist rate is <span class="math-container">$$f_N = 2 \times 20 \text{ kHz} = 40 \text{ kHz}.$$</span> According to Example 7.4.2 in , for DPCM, the bit rate is <span class="math-container">$$R = v_{DPCM} f_s \geq v_{DPCM} f_N = v_{DPCM} \times 40 \text{ kHz}.$$</span> On the other hand, <span class="math-container">$$R \leq R_{b\_max}.$$</span> Therefore, <span class="math-container">$$v_{DPCM} \times 40 \text{ kHz} \leq 1.5948 \times 10^6 \text{ bits/s}.$$</span> Then <span class="math-container">$$v_{DPCM} \leq \frac{1.5948 \times 10^6}{40 \times 10^3} = 39.87 \text{ bits}.$$</span> Again, the number of bits must be a positive integer. So <span class="math-container">$$v_{DPCM} \leq 39 \text{ bits}.$$</span></p> <p>(d) In DM only one bit per sample is employed, so <span class="math-container">$$f_s = R \leq R_{b\_max}.$$</span> This implies that <span class="math-container">$$f_s \leq 1.5948 \times 10^6 \text{ Hz} = 159.48 \text{ kHz}.$$</span> On the other hand, <span class="math-container">$$f_s \geq f_N = 40 \text{ kHz}.$$</span> So <span class="math-container">$$40 \text{ kHz} \leq f_s \leq 159.48 \text{ kHz}.$$</span></p> <p>(e) I think PCM, DPCM, and DM can be all suitable to transmit through the channel. But I am not so sure. <span class="math-container">$\blacksquare$</span></p> <p><strong>Reference:</strong></p> <p> J. G. Proakis and M. Salehi, <em>Fundamentals of Communication Systems</em>, Second Edition, Pearson, 2014.</p> https://dsp.stackexchange.com/q/86909 0 Confusion regarding MATLAB?Can't we represent continous time signals properly(fully and completely)? engr https://dsp.stackexchange.com/users/39794 2023-03-02T04:21:17Z 2023-03-21T20:30:38Z <p><a href="https://dsp.stackexchange.com/questions/86852/which-command-should-be-used-for-quantization-of-a-signal-in-matlab">Which command should be used for quantization of a signal in MATLAB?</a></p> <p>Please check above question link especially answer of @Hilmar, especially the first paragraph of answer and especially the highlighted statement:</p> <p>&quot;Every signal that's represented as a vector or a matrix in Matlab is already quantized. <strong>You can't really represent an analog signal in Matlab: once it's list of numbers</strong>, it's discrete in time and in amplitude&quot;</p> <p>Does this statements holds true for each and every case??</p> https://dsp.stackexchange.com/q/86707 0 Propagation channel model for 5G/6G commmunication Aid22 https://dsp.stackexchange.com/users/65144 2023-02-17T12:19:07Z 2023-03-20T20:02:30Z <p>from a course in signal processing, I know some radio propagation models such as Free-space path loss, Okumura model, Hata model, and COST Hata model. They applied to a range of frequencies for up to 2 GHz.</p> <p>5g/6G frequency range is more than 2 GHz, 6G is THzband</p> <p>What model do you use to describe 5G and 6G propagation links?</p> https://dsp.stackexchange.com/q/85377 0 Is the beamforming result described by this matlab code useful? hyrt https://dsp.stackexchange.com/users/65321 2022-11-16T00:34:50Z 2023-03-20T08:36:58Z <p>A narrow-band beamformer for <span class="math-container">$0$</span> degree in the frequency domain is created for <span class="math-container">$8$</span> sensors and compared with a usual delay and sum beamformer. The question can also be expressed as : can we have better beamforming solution by &quot;masking the spatial frequency&quot; to our usual beamforming result?</p> <p>A beamformer create a weight vector and performs dot product with every spatial i.e. array wise, received vector to allow signal from a desired direction and suppress others. In delay and sum beamformer the weights are calculated based on the expected delay from the desired angle. In the code below delay and sum beamformer weight is given by the variable name delaySumWeights. Further, the code simulates received signal from -180 to 180 degress and compare the performance of the delay and sum beamformer and the other beamformer.</p> <p>The process of the algorithm is not given but can anyone please check and verify if such an algorithm is useful. I understand that how the algorithm does it, is not given, but can't one understand it's usefulness from knowing what it does? The question has only a few matlab lines and a graph. The code of the matlab file <em>testVer.m</em> is not given.<br /> I appreciate any comments.</p> <pre><code>clear all clc close all noOfSensors = 8; f = 8e3; distanceBetweenSensors = 15/1000; velocityWave = 340; angles=-2*pi*f(1)*[0:noOfSensors-1]*distanceBetweenSensors/velocityWave; diR=cos(angles)+1j*sin(angles); delaySumWeights=diR/noOfSensors; theta = -pi:pi/50:pi; scanningMatrix = zeros(noOfSensors,length(theta)); for I=1:length(theta) scanningMatrix(:,I) = exp(-j*2*f*pi*[0:noOfSensors-1]'*distanceBetweenSensors*cos(theta(I))/velocityWave); end ampli = (((rand+1j*rand))); ampli = ampli/abs(ampli); phaseOfSource = ampli*eye(length(theta)); receivedSignal = scanningMatrix*phaseOfSource; yValuesTestHat=testVer(receivedSignal); [cc,rr]=size(receivedSignal); for k=1:rr delaySum(k)=conj(delaySumWeights)*(receivedSignal(:,k)); end figure hold on plot(theta,(abs(yValuesTestHat.*delaySum))) plot(theta,(abs(delaySum))) grid on legend('New','delaySum') title('Comparison') </code></pre> <p><a href="https://i.stack.imgur.com/aFdxf.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/aFdxf.jpg" alt="enter image description here" /></a></p> https://dsp.stackexchange.com/q/54258 3 FIR butterworth also possible or just IIR? abt https://dsp.stackexchange.com/users/39564 2018-12-19T17:55:39Z 2023-03-20T20:18:21Z <p>can we use butterworth and other such filters like chebyshev,elliptic etc with FIR</p> <p>or they can be only used with IIR?</p> https://dsp.stackexchange.com/q/16105 8 The difference between DFT and DFS phanitej https://dsp.stackexchange.com/users/7926 2014-05-08T14:30:46Z 2023-03-19T11:01:54Z <p>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?</p>