New answers tagged

0

So, Now I have done a little bit more, Now I'm generating a complex reference sine wave, The things that I have done are as follow clear clc %ADC sin wave, it represent the data that I have captured with the ADC %and want to estimate the frequency ADCsin = dsp.SineWave(1,50.1); ADCsin.ComplexOutput = false; ADCsin.SampleRate = 12800; ADCsin.SamplesPerFrame =...


0

As you can see in MATLAB documentation for FFT If you have Y = fft(x) then $$Y_k = \sum_{j=1}^{N} x_j \cdot exp\left(-\frac{2 \pi i}{n} (k - 1) (j - 1)\right)$$ $$x_j = \frac{1}{n} \sum_{k=1}^{N} X_k \cdot exp\left(+\frac{2 \pi i}{n} (k - 1) (j - 1)\right)$$ Notice that the FFT is just a sum and the IFFT is divided by $n$, with this definition you know ...


0

Answer to: Is there an easier way to count fringes? I synthesized an image to resemble your image with x = linspace(0, 1, 256); [x,y] = meshgrid(x,x); image = sin((7*x + 2*y) * 2*pi) ./ (0.1 + (x - 0.5).^2 + (y - 0.6).^2); imagesc(image); Then I can get the vector the 2D FFT A = abs(fft2(image)); A = A(1:end/2, 1:end/2) [~, imax] = max(abs(A(:))) % 899 % ...


0

AWGN is additive in nature by definition, so you won't need any deconvolution to estimate transmitted symbols. Received samples are obtained as : $$y[n] = x[n] + w[n]$$ where $w[n]$ are Complex Circular Symmetric White Gaussian Noise samples. In OFDM receiver when you strip-off cyclic prefix and take FFT of the received samples, you get Freq-Domain vectors ...


6

In your original code you defined the sampling interval to be $T_s=0.05$ (idd1 = iddata(ddout, ddin, 0.05);). Yet, according to the data file, the time step between sample points appears to be $T_s=0.003$. Changing $T_s$ from $0.5$ to $0.003$ should compress the step response by a factor of $0.05/0.003=16.67$, which compares favorably to the relation between ...


1

@Ali23. If by "How can I get a blue lines?" you mean how to generate samples of the your red curve, try the following: m = [1, -1, -1, 1 1, -1]; m = [m m m m]; N = length(m); M = 10; mup=zeros(1,NM); mup(1:M:NM)=m; % oversample by M h = hamming(M); % blip pulse of width M x = filter(h,1,mup); % convolve pulse shape with 'm' ...


1

@Ali23. your 'binary_data = rand(1,M) > 0.5;' command generates "logical" data. Try using 'binary_data = int8(rand(1,M));' and see if that helps you.


0

you can use envspectrum. a good example is shown in this example.


1

The output of an FIR filter is $$ y(n) = \sum_{i=0}^{N-1}w_i(n)x(n-i) $$ Say the weight vector $\mathbf{w}(n)$ has a length of $N$, i.e., $$\mathbf{w}(n) = [w_0(n), w_1(n), \ldots, w_{N-1}(n)]^T$$ and the input vector $\mathbf{x}(n)$ should have the same length as $\mathbf{w}(n)$: $$\mathbf{x}(n) = [x(n), x(n-1), \ldots, x(n-N+1)]^T$$ Therefore the output $y(...


0

In short, and importantly, YES you can absolutely and simply use freqz if desired to compute the samples on the DTFT of a signal. The following produce identical results: DTFT_1 = freqz(signal, 1, N, 'whole') DTFT_2 = fft(signal, N) Note the second form is simpler and is the zero padding of the waveform signal out to N samples, which produces N samples on ...


0

1 - What transfer function are you trying to implement? The controller transfer function or the "plant" transfer function? 2 - You are trying to simulate some kind of inverter/active rectifier, right? Inverters are non-linear, you can simulate them with only linear blocks if you want but you will not be able to test your controller with the non-...


3

The MATLAB / OCTAVE function freqz(b,a) is typically used for displaying the magnitude and the phase of a Frequency Response function $H(e^{j\omega})$ associated with a discrete-time, linear time-invariant (LTI), system with rational transfer function $H(z)$ (having a corresponding LCCDE representation) given by $$H(z) = \frac{ \sum\limits_{k=0}^{M} b_k z^{-...


1

Basically they cascade moving-average filters, or CAF. a Moving-average filter has the following coefficients $h_{av}(m) = 1/M, m = 0, 1.. M-1$ In Matlab it would look like this h = ones(1,M)./M; y = filter(h,1,x); If you want to cascade three moving-average filters h = ones(1,M)./M; y1 = filter(h,1,x); y2 = filter(h,1,y1); y3 = filter(h,1,y2); M should be ...


1

Given a RGB value as a 1d array you can get the pixel's image coordinates using a combination of the following built-in MATLAB functions find, prod and reshape: [row, col] = find(prod(img == reshape(val, 1, 1, 3), 3)) where img is a $N\times M\times 3$ image array and val is a 1d array with 3 elements $1\times 3$ or $3\times 1$, it's the RGB color value of ...


3

Yes, C\C++ code generated from Matlab/Simulink code should behave the same as the original code. However there are a few caveats, here are 3 problems I've experienced in real-life. 1 - Simulink\Matlab performs an implicit reset just before starting the simulation/script. Make sure you perform this reset in your C\C++ code, otherwise your results won't be the ...


1

Does the "Energy Threshold" carry information about the end of the noise and the beginning of the packet due to the calculated arithmetic mean? There's no such thing as "end of noise": Nothing says that noise can't take values that are as large (or larger) than your signal's power; in "benign" noise, these values are just rare. ...


1

Absolute phase is rarely meaningful since is it's highly dependent on your exact definition of your time reference, i.e. what exactly does $t=0$ mean. Since your time reference changes from frame to frame, so does the phase. If you know the fundamental frequency EXACTLY and it's phase locked to your sample clock, you can fix this simply by making the hop ...


2

As long as your C++ implementation uses the same data types and the same algorithm structures the results should either be very close or even bit-exact, provided both platforms are compliant with "normal" standards, i.e. IEEE-754. The link to the Matlab code doesn't work ("forbidden"). A quick look at your C++ code shows that you are ...


Top 50 recent answers are included