texts: Implementation of PCA for hyper-spectral Image Processing

texts:
I have been studying the concept of PCA and its implementation for dimensionality reduction for more than 1 month. My goal is to classify a hyperspectral image using sparse representation by the linear combination concept  which is as follow:

$$y = Dx$$

So consider $D$ as a dictionary with $d\times  B$ dimension where $d=3000$ is the number of samples and $B=200$ is the number of band/channel.

Now I am trying to construct the $D$ by this mean that the classes (sub-dictionaries) are well separated. Therefore I want to apply PCA to individual sub-dictionary in order to form the main dictionary.

However, my goal is to apply PCA on hyperspectral satellite imagery like this.

I have implemented the PCA in Octave and project my data on that particular low dimension.  But my question is should I reduce the number of training pixels(observation=d$$) or reduce the variable dimension ($B$)?

Since I use sparse representation and dictionary concept then reducing the dimension of $d$ (observation pixels for individual classes) is more make sense rather than reducing the number of features ($B$). But I am not sure if I am right or not.

After constructing the $D$ should I transform $y$ to PCA dimension before computing its spars coefficients or not?


texts: OFDM signal spectrum and characterisitics

texts:
Is it correct to say that the spectrum of an OFDM signal is rectangular pulse?

What about the spectrum of each transmitted signal over subcarriers?

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?


texts: Berchin's FDLS arbitrary filter design algorithm

texts:
I'm trying to use Berchin's FDLS methods (for those that don't know what it is, it's a way to design arbitrary magnitude and phase of an IIR Eq)

I tried different things but neither gave me what i asked:

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
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)

I used a samplerate of $316$, $M=158$ points and a filter order of around $50$.

Do I need to use more points to increase the filter order or is it just impossible to design my filters using that algorithm?


texts:
I want to modulate this signal if possible with an Arduino, but have no idea what circuit can help me here. Let's ignore the timing and the measurements from the image for a moment, my problem is more about the alternating shape of the signal.
I'm a beginner here and learning a lot at the moment. I don't wan't any complete circuits or code, but would be grateful if u could push me in the right direction. Thanks


texts: How Does the Non Local Means Filter Work?

texts:
As I understand,

A local mean filter is the one in which we take a pixel and calculate the mean of color-values of the pixels around them (but in a certain range of area) and the center pixel is replaced by that mean value.
The filter always has a specific size. For instance, 3x3, 5x5, and so on.
The filter sweeps the whole image row by row to achieve a filtered image (spatial domain), or, the FT of the image is multiplied by the FT of the filter (frequency domain).

But, I could not understand the case of a Non-Local Mean (or, median, or whatever) filter.

How is the the value of the non-local mean calculated?
How does that value replaces a pixel?
How does that filter sweeps the image?


texts: Simple and efficient algorithm to detect frequency and phase of a sine signal

texts:
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.

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.

Can anyone suggest what algorithm to use to do this simple and efficient? Maybe Goertzel algorithm?


texts:
Hello i am trying to calculate the amplitude loss of non ideal sampling.
My signals amplitude is 10 at 70 frequency.
When we sample it at Fs=400 we have al 0.511 loss as shown in plot bellow.
How can we get this 0.511 using the ZOH sinc formula bellow. What is f,Tpm,Ts is here so i could see the 0.511 loss? MATLAB code bellow.
Thanks.

f3=70;
Fs=400; % sampling frequency is a bit above 2 times to get all the peaks.
Ts=1/Fs;
Tn=0:Ts:1;
fft_L=length(Tn);
y4_samples=10*sin(2*pi*f3*Tn);
%stem(Tn_new,y4_samples);
ff=fft(y4_samples);
ff1 = abs(ff/fft_L);% normalised FFT
fft2 = ff1(1:floor(fft_L/2)+1); %first half of the vector
fft2(2:end) = 2*fft2(2:end); %we multiply the amplitude by 2
f = Fs*(0:fft_L/2)/fft_L;%frequency vector
plot(f, fft2)


texts: Histogram estimation (from sub-set of image pixels)

texts:
Problem: How to find gray-scale image histogram without iterating all pixels and binning them.

Description:
Suppose that I have large set of images with no common scene and of different resolutions. For each image I would like to compute histogram but to save processing time, I want just an estimate rather than finding the full histogram.

One way which is more or less obvious is to take just sub-set of pixels in a clever way and use these to determine the estimate. The problem is then how to sample the image (which pixels to take) so that the estimate is really representative (similar to full histogram). What would be a good sampling technique to use? E.g. the simplest may be to take N samples at random positions. I have thought of some approaches but I'd be interested if there are any that were proven to give good estimate or, if there are none, in your ideas what could work.

There may be also different approaches to histogram estimation that I didn't think of other than (or complementing) taking sub-set of pixels. I'd be glad for pointing out anything that may improve estimate or processing speed.

I was searching for some time but there seems to be no scientific papers or other resources that would discuss this issue.


texts: Sound absorption coefficients for frequencies higher than 8kHz and lower than 80Hz?

texts:
I am building a matlab simulation that applies room compensation to a 3D audio rendering system, and I'm searching for the frequency dependent sound absorption coefficients of various materials in order to extract the reflection coefficients.

However all the tables I found provide absorption coefficients for different octave frequency bands that have center frequency from 125Hz to 4kHz or at most 8kHz, but in my case I need to consider frequencies up to 20kHz.

My question is why are tables for sound absorption coefficients limited to such frequency range and how should I consider the coefficients for higher frequencies(i.e. higher than 10kHz) and also for lower ones(i.e. lower than 80 Hz)?

I found the tables in the annex section of the book "Auralization" by Dr. Michael Vorländer, which uses the ISO 354:2003 standard in order to perform the measurements.

The only resource where I found tables for frequency values higher than 8kHz  was this paper: https://www.degruyter.com/downloadpdf/j/aoa.2013.38.issue-2/aoa-2013-0020/aoa-2013-0020.pdf where it is proposed an alternative method w.r.t. the previously mentioned standard in order to take the measurements from 50Hz to 50kHz, however these are provided just for very few materials.


texts:
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 "smoothness" 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.
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!


texts:
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.

So can anybody  explain advantages and disadvantages of JPEG and JPEG2000 with the help of (characteristics of)  transforms they use?


texts: Correct form of discrete-time Fourier series representation

texts:
As I see in this slides, Fourier series representation for discrete-time signal $s[n]$ with period $N$ is $\sum_{k = 0}^{N-1} c_k e^{j2\pi k n / N}$

According to Wiki, Fourier series representation for continuous-time signal $s(x)$ with period $P$ is $s_{\infty}(x) = \sum_{n = -\infty}^\infty c_n e^{j 2\pi n x / P}$

My question is that why in discrete-time Fourier series representation, they only sum up from $0$ to $N - 1$ instead of from $-\infty$ to $\infty$ ? Is the slides above gives a wrong formula ?

P.s: in my opinion, the more terms we have, the more accurate our Fourier series is


texts: Drawbacks of upsampling using polynomial interpolation

texts: I've come across an upsampler that uses polynomial interpolation and no filter. What are the drawbacks to this? I looks more efficient than filtering.


texts: 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.


texts:
I sit in a cafe and start recording my voice, reading a poem. Then I sit at my room, at complete isolation, and I read the same exact poem once again and record it.

Now, Considering I have these two recordings, How can I capture the ambient sounds in the cafe? in fact, how can I cancel my own sound from the cafe-recorded-sound?

I already did LMS to enhance my voice in the cafe-recorded-sound. Then when I subtract the resulted enhanced speech from the original mixed track, I still cannot have the ambient sound.

What should I do?


texts: Problem getting DTW to work for speech recognition

texts:
I used my ipad to record the words "This. Is. A. Test. This. Is. A. Test.", then downloaded it to my computer as a .MOV file and used ffmpeg to extract audio as WAV. I then used the tuneR package to load the WAV file into R.

library(tuneR)
sndObj <- readWave('myinput.wav')
plot(sndObj@left, type = "l")

It loads fine and the plot looks ok. The problem comes when I segment the words and calculate DTW distances between all pairs of words (using the DTW package in R).

I can't find any evidence that DTW distance is smaller between the correct pairs than between any other pairing (i.e "this->this" is about the same DTW distance as "this->a". Am I missing any important preprocessing?

Below: sample heat map of actual vs expected DTW distances.


texts: Log in MFCC vectors incorrect according to Source-Filter Theory

texts:
In the MFCC vectors computation given many in places and here we apply log after we average with the mel bands. However, the source-filter theory says that the source frequency is modified by the filter of the vocal cords and mouth in the frequency domain

This action can be written as a convolution operation between an input response and filter and taking the log separates them to additive components as given here.
So it makes sense for the log to be taken in the frequency domain. However we pool with the mel bands and then take the log implying that the source and filter convolve in the mel space. According to source-filter theory we should take log then pool via mel bands but opposite is done. Can anyone clarify this discrepancy?


texts: Shift estimation using fourier transform

texts:
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.

S1 = fftshift(fft2(im1)); % Fourier transform of the reference image
S2 = fftshift(fft2(im2)); % Fourier transform of the image to be registered
Q = S1./S2;
A = angle(Q);

How can i use the phase shift Ato estimate the shift in both directions?


texts: What are the equations for magnitude plots of the common IIR filters? (Are the ones I have so far correct?)

texts:
I need equations that describe the magnitude plots of basic IIR filter types. I had looked into this a few years ago and saved some equations but it only covers part of what I need, and I can't recall where I got them. Here is what I have, where $y$ is amplitude from 0-1, $x$ is freq in Hz, and $c$ is cutoff freq in Hz:
One Pole LPF:
$y = \frac{1}{\sqrt{1+(\frac{x}{c})^2}}$
One Pole HPF:
$y = \frac{\frac{x}{c}}{\sqrt{1+(\frac{x}{c})^2}}$
Two Pole Resonant LPF:
$y = \frac{1}{\sqrt{(1-(\frac{x}{c})^2)^2+(\frac{x}{Qc})^2}}$
Two Pole Resonant HPF:
$y = \frac{(\frac{x}{c})^2}{\sqrt{(1-(\frac{x}{c})^2)^2+(\frac{x}{Qc})^2}}$
Bandpass (with max out = 1):
$y = \frac{(\frac{x}{Qc})^2}{\sqrt{(1-(\frac{x}{c})^2)^2+(\frac{x}{Qc})^2}}$
Band reject (to zero at cut freq):
$y = 1 - \frac{(\frac{x}{Qc})^2}{\sqrt{(1-(\frac{x}{c})^2)^2+(\frac{x}{Qc})^2}}$
These all seem to graph reasonably and I believe they are accurate formula. (Please correct me if not.) You can see their shapes here for a demonstration cut frequency of 10 kHz, Q of 1.7:

I am wondering:

What would be the change to these equations for higher pole numbers like 3rd, 4th, or 5th order?
How would you go about expressing a first/second order shelving filter in terms of the same parameters?
What would be an equation for a sharp notch filter, bandpass which can peak above amplitude 1 (like a resonant peak same as the other resonant filter graphs), or band reject that does not go all the way to 0 (like an EQ notch filter)?

(Please note I do not actually need to EQ or filter anything in the traditional manner. I just want equations that can graph/predict the common shapes in this manner.)
One problem I see with my current equations is the resonant HPF/LPF are causing an increase in amplitude at the cut frequency. I believe even with a resonant HPF/LPF the cut freq should be -3 dB from amplitude 1.
Thanks.


texts: How can I generate a time domain square pulse that relies on frequency and not zero centered at MATLAB?

texts:
I want to create a square pulse, then use FFT on it. However, this code does not relies on central frequency to generate a pulse, and it is centered at 0 in time and frequency.

fs=500; %sampling frequency
T=0.2; %width of the rectangle pulse in seconds
t=-0.5:1/fs:0.5; %time base
x=rectpuls(t,T); %generating the square wave
plot(t,x,'k');
title(&#91;'Rectangular Pulse width=', num2str(T),'s']);
xlabel('Time(s)');
ylabel('Amplitude');
L=length(x);
NFFT = 1024;
X = fftshift(fft(x,NFFT)); %FFT with FFTshift for both negative &amp; positive frequencies
f = fs*(-NFFT/2:NFFT/2-1)/NFFT; %Frequency Vector
figure;
plot(f,abs(X)/(L),'r');
title('Magnitude of FFT');
xlabel('Frequency (Hz)')
ylabel('Magnitude |X(f)|');

this will give the following plot:

I tried mixing this code( Gaussian pulse) with the square pulse, but it didn't work.

lambda= 800e-9;%Wavelength
c=3*10.^8;%lLight speed
fc = c/lambda; % Actual Frequency of light [THz]
fsamp=fc*10; %sampling frequency
fs=1/fsamp; %Unit Time in [fs]
Ls=1000; %Length of signal
sigma=lambda/1e+8;% Pulse duration
ts=(0:Ls-1)*fs; %time base
t0 = max(ts)/2; % Used to centering the pulse
gauss = (exp(-2*log(2)*(ts-t0).^2/(sigma)^2)).*cos(-2*pi*fc*(ts-t0));
subplot(2,1,1)
plot(ts,real(gauss),'b');
title('Gaussian Pulse in Time Domain');
xlabel('Time(s)');
ylabel('Amplitude');
grid on;
NFFT = 2^nextpow2(Ls);
X = fft(gauss,NFFT)/Ls;
freq = 0.5*fsamp*linspace(0,1,NFFT/2+1); % (full range) Frequency Vector
subplot(2,1,2)
plot(freq,abs(X(1:NFFT/2+1)))
title('FFT of the Gaussian Pulse');
xlabel('Frequency (Hz)')
ylabel('Magnitude |X(f)|');
grid on;

Which will give:

As can be seen in this code, the unit time relies on the central frequency and it's not centered at zero. I think its because of fs, T, and t. How can I make it change time whenever I change frequency, while not centered at time and frequency equal 0?


texts: How to add noise to a vector-valued simulation?

texts:
In past I have added noise to images where % noise is
$$
\frac{\text{var}(noise)}{\text{var}(image)}
$$
easily converted to dB if need be.

I have here a vector valued elasticity simulation I wish to add noise to. Nearly all of the displacement is through one particular plane. So I am not sure taking the variance of the whole data set will give me the right measure, I think it will be too low as the perpendicular displacement components are close to zero. But, it doesn't seem right that the additive noise should be different for each component.

Any suggestions for how to correctly add _% Gaussian noise to this simulation?


texts:
I am computing FFT of the data which I am receiving from an ADC with SPI protocol. Since resolution of FFT is related to $F_s/N$ where $N$ is the FFT length and $F_s$ is the sampling frequency of ADC, when I lower sampling frequency, it should decrease frequency range that I see due to Nyquist–Shannon sampling theorem and conversely it should also increase my FFT resolution.

I am plotting this FFT in realtime and I've given 1 Hz sinusoidal signal via arbitrary signal generator and tested various sampling frequencies to see which point 1 Hz equals to.

╔═══╦═══════════════╦═══════════════╗
║   ║ Sampling Freq ║ Point of 1 Hz ║  0. point included
╠═══╬═══════════════╬═══════════════╣
║ 1 ║ 20k           ║ 3             ║
║ 2 ║ 10k           ║ 6             ║
║ 3 ║ 1k            ║ 9             ║
║ 4 ║ 100           ║ 9             ║
╚═══╩═══════════════╩═══════════════╝

No matter how I lower sampling frequency, it doesn't go further than 9. By the way, my FFT length is 1024.


texts: Split audio signal into frames, apply window function and merge again

texts:
First off: I'm really new in the signal processing department and MatLab as well, so please bear with me here.

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 Hamming or Hann), and then add it together again (write out a new sound file), so that I basically get the original signal back. Someone mentioned overlap-add, but I'm not quite sure if convolution is correct here, as mentioned, I'm new to all this.

So I have a sound file that I read like this:

function output = readSoundFile(filename, channels)

if isscalar(channels)
    chN=channels;
    channels=ones(1,chN);
else
    chN=length(channels);
end

fid=fopen(filename,'r','n');
[output, elementCount] = fread(fid,[chN,inf], '*int16');
fclose(fid);

for i=chN:-1:1
    if channels(i) == 0
        output(i,:)=[];
    end
end

end

In another MatLab file, I use the readSoundFile function:

fileUrl = 'whatever/file.format';
sound = readSoundFile(file);
soundsc(double(sound), 16000); % sound is sampled with 16kHz. Don't know, if this information is needed

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?

Should it help, I can convert the file into a wav file, if wavread/audioread would be any easier.


texts:
I am new to image processing and had the following question:

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

there is a better way of aligning frames
removing artifacts which are not common in all the frames
improve the sharpness (is there a best know method to do this?)
do noise reduction (when I try and sharpen an image, my shot noise shoots up)
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.

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


texts: Confusion understanding phase shift/delay?

texts: I am reading proakis, as shown highlighted in attached snap shot,there is '-'sign along with j,but still it is written (underlined red) implies shift in positive n direction,why and how positive?when we have negative sign with j?


texts: Stereo triangulation similar triangle derivation

texts: I understand that the similar triangles are the red and blue triangles. I'm trying to understand where $T + x_r - x_l$ comes from. I understand we are trying to compute the length of the base of the blue triangle, but I'm not sure how this expression is finding that.


texts:
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.

My code is a pretty direct implementation of the matrix-formulation so I'm not clear on what the problem is

//                                |
// radix-4 butterfly matrix form  |  complex multiplication
//                                |
//        +-          -+ +-  -+   |    a+ib
// X[0] = | 1  1  1  1 | |x[0]|   |  * c+id
// X[1] = | 1 -i -1  i | |x[1]|   |    -------
// X[2] = | 1 -1  1 -1 | |x[2]|   |    ac + ibc
// X[3] = | 1  i -1 -i | |x[3]|   |         iad - bd
//        +-          -+ +-  -+   |    ------------------
//                                |    (ac-bd) + i(bc+ad)
//                                |

Can anybody spot where I went wrong?

Thanks,

-David

typedef double fp; // base floating-point type

// naiive N-point DFT implementation as reference to check fft implementation against
//
void dft(int inv, struct cfp *x, struct cfp *y, int N) {

  long int i, j;
  struct cfp w;
  fp ang;

  for(i=0; i<N; i++) { // do N-point FFT/IFFT
    y[i].r = y[i].i = 0;
    if (inv) ang =  2*PI*(fp)i/(fp)N;
    else     ang = -2*PI*(fp)i/(fp)N;
    for (j=0; j<N; j++) {
      w.r = cos(j*ang);
      w.i = sin(j*ang);
      y[i].r += (x[j].r * w.r - x[j].i * w.i);
      y[i].i += (x[j].r * w.i + x[j].i * w.r);
    }
  }

  // scale output in the case of an IFFT
  if (inv) {
    for (i=0; i<N; i++) {
      y[i].r = y[i].r/(fp)N;
      y[i].i = y[i].i/(fp)N;
    }
  }

} // dft()

void r4fft4(int inv, int reorder, struct cfp *x, struct cfp *y) {
  struct cfp x1[4], w[4];
  fp         ang, temp;
  int        i;

  //                                |
  // radix-4 butterfly matrix form  |  complex multiplication
  //                                |
  //        +-          -+ +-  -+   |    a+ib
  // y[0] = | 1  1  1  1 | |x[0]|   |  * c+id
  // y[1] = | 1 -i -1  i | |x[1]|   |    -------
  // y[2] = | 1 -1  1 -1 | |x[2]|   |    ac + ibc
  // y[3] = | 1  i -1 -i | |x[3]|   |         iad - bd
  //        +-          -+ +-  -+   |    ------------------
  //                                |    (ac-bd) + i(bc+ad)
  //                                |

  if (inv) ang =  2*PI/(fp)4; // invert sign for IFFT
  else     ang = -2*PI/(fp)4;
  //
  w[1].r = cos(ang*1); w[1].i = sin(ang*1); // twiddle1 = exp(-2*pi/4 * 1);
  w[2].r = cos(ang*2); w[2].i = sin(ang*2); // twiddle2 = exp(-2*pi/4 * 2);
  w[3].r = cos(ang*3); w[3].i = sin(ang*3); // twiddle3 = exp(-2*pi/4 * 3);

  //         *1       *1       *1       *1
  y[0].r  = x[0].r + x[1].r + x[2].r + x[3].r;
  y[0].i  = x[0].i + x[1].i + x[2].i + x[3].i;
  //         *1       *-i      *-1      *i
  x1[1].r = x[0].r + x[1].i - x[2].r - x[3].i;
  x1[1].i = x[0].i - x[1].r - x[2].i + x[3].r;
  //         *1       *-1      *1       *-1
  x1[2].r = x[0].r - x[1].r + x[2].r - x[3].r;
  x1[2].i = x[0].i - x[1].i + x[2].i - x[3].i;
  //         *1       *i       *-1      *-i
  x1[3].r = x[0].r - x[1].i - x[2].r + x[3].i;
  x1[3].i = x[0].i + x[1].r - x[2].i - x[3].r;
  //
  y[1].r = x1[1].r*w[1].r - x1[1].i*w[1].i; // scale radix-4 output
  y[1].i = x1[1].i*w[1].r + x1[1].r*w[1].i;
  //
  y[2].r = x1[2].r*w[2].r - x1[2].i*w[2].i; // scale radix-4 output
  y[2].i = x1[2].i*w[2].r + x1[2].r*w[2].i;
  //
  y[3].r = x1[3].r*w[3].r - x1[3].i*w[3].i; // scale radix-4 output
  y[3].i = x1[3].i*w[3].r + x1[3].r*w[3].i;

  // reorder output stage ... mystery as to why I need this
  if (reorder) {
    temp = y[1].r;
    y[1].r = -1*y[1].i;
    y[1].i = temp;
    //
    y[2].r = -1*y[2].r;
    //
    temp = y[3].r;
    y[3].r = y[3].i;
    y[3].i = -1*temp;
  }

  // scale output for inverse FFT
  if (inv) {
    for (i=0; i<4; i++) { // scale output by 1/N for IFFT
      y[i].r = y[i].r/(fp)4;
      y[i].i = y[i].i/(fp)4;
    }
  }

} // r4fft4()


texts: Comparison between 2 images in Frequency domain

texts:
As you can see there are 2 images from the Tom and Jerry cartoon program.

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.

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 Fourier transform ?
Also,is it possible to find out location  of Jerry in the image using any frequency transform method? If yes can you explain how?


texts: Finding the right measure to compare sound signals in the frequency domain

texts:
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.

I used SpecCentroid() found in File Exchange to calculate the linear mean spectrum centroid. Then I also used the function meanfreq() and medianfreq() from MATLAB.

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.

Thanks a lot.

EDIT:

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.

Here is the same plot as before in the linear scale:

EDIT 2:

After Laurent Duval's answer and suggestions, I tested the estimated peak location, with different weights. For the signal example given above, I got:

\begin{array}{|c|c|c|}
\hline\text{$p$} & \text{$f$} & \text{dispersion $d$} \\
\hline
1 & 979.6 & 979 \\
2 & 493.12 & 627\\
3 & 327 & 295\\
4 & 296 & 135\\
5 & 291.14 & 65\\
6 & 285 & 35\\\hline
\end{array}

The peak frequency as found with findpeaks() was $285$.

Let's take one of my more noisy signals:

\begin{array}{|c|c|c|}
\hline\text{$p$} & \text{$f$} & \text{dispersion $d$} \\
\hline
1 & 1460 & 826\\
2 & 1295 & 768\\
3 & 1122 & 719\\
4 & 955 & 648\\
5 & 811 & 562\\
6 & 698 & 470\\\hline
\end{array}

The peak frequency as found with findpeaks() was $427$.
Example at $p=4$:

It is quite clear that the dispersion is much higher than for the last (less noisy) signal.


texts: How to find transfer function looking bode plot

texts:
I have some Bode plot (only in amplitude) as these:

Now, I must to find their transfer functions, in particular the exact value of their zeros and poles.

It is clear that their are a low pass filter and a high pass filter.

I'm looking for a method for extract the numerical value of their transfer function.

Thank you and bye,
Giacomo


texts:
What is one exactly referring to when you say "baseband signal processing algorithms"?
Can anyone give a few (common) examples.


texts:
I try to implement CIC filter with truncation in hardware, but there is some misunderstanding. For some reason the output signal is broken.
My filter is N = 6, R = 20, M = 1, Bin = 16, Bout = 16.
(Where N - order, R - downsampling ratio, M - differential delay, Bin - input bit width, Bout - target output bit width)
I use Rick Lyons article and code for CIC stages truncation calculation. Xilinx Vivado (CIC Compiler 4.0) calculate same 'Bits per stage'.
 Stage(j)   Bj   Accum (adder) width
   1        1        41
   2        5        37
   3        9        33
   4       12        30
   5       15        27
   6       18        24
   7       19        23
   8       20        22
   9       21        21
  1e+01    22        20
  1e+01    22        20
  1e+01    23        19
  1e+01    26        16 (final truncation)

Full precision Bin + ceil(log2((R*M)^N)) for that case is equal 42.

The corresponding structure, as I understand it, is below.

But if I try filter some Bin = 16 bit sine wave, CIC output wil be incorrect.

For other signal level, for example 15 bit sine wave signal spectrum is fine.
For other combinations N = 6, R = 20, M = 1, Bin = 16, Bout = 19 output as well fine.
I think I'm wrong with these truncations, but don't know where.
I change one stage in truncation set = [41 37 33 30 27 24 23 22 21 20 20 19 16]', i take 42 instead 41 at 1st stage, and the signal returned to normal. But is it right to do this?
Spectrum for set = [42 37 33 30 27 24 23 22 21 20 20 19 16]'

There is one thing - I ignore the first truncation, where the signal is immediately truncated in half. Is this my fault? Need to lose some of the information bits before filtering, why?

Matlab model for first block diagram


texts: Extracting common signal without knowledge about noise

texts:
Given two noisy time series thought to contain a common signal,
$$ x_1(t) = s(t) + n_1(t), \quad x_2(t) = s(t) + n_2(t), $$
what is the best way to determine $s(t)$ without assuming any distribution for the noise terms $n_i(t)$?

In particular, the $n_i(t)$ are neither Gaussian nor stationary. The only assumption I am willing to make is that $n_1(t)$ and $n_2(t)$ have zero mean and are uncorrelated with each other, i.e. $E(n_1(t) n_2(t)) = 0$ (though even this assumption can be broken in my problem, but only slightly).

Is it true that the best estimate is simply
$$ \frac{x_1(t) + x_2(t)}{2}? $$

I am particularly interested in finding not only an estimate for $s(t)$, but also a measure of the uncertainty of this estimate.


texts: 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.


texts: How many bins to include when calculating SNR from FFT?

texts:
I'm a scientist conducting an experiment that requires some signal processing. My expertise is not in signal processing, thus here I am. We've basically re-created an experiment conducted by other scientists, attempting to check their results. Here is a link to their paper: Ultrasensitive Inverse Weak-Value Tilt Meter
In short, a laser bounces off of some mirrors, one of which is oscillating at a controlled sinusoidal frequency, onto a quadrant detector, which outputs an electrical signal to an oscilloscope where we record it. So, you end up with a noisy record that has a tiny, known sine wave hiding in it.
My question has to do with calculating the SNR from the FFTs of our records. How many bins do I include for noise? Do I include all of the non-signal bins (besides DC and Nyquist)? Or is there some standard for this type of thing?
As a follow on question, when determining the noise floor from our spectral densities, is there a certain standard calculation, or is it more of an eyeball the plot type thing? Is the floor determined for bins near the signal, or should you look at the whole record?
Thanks in advance for any help you can provide. As a side note, I have done quite a bit of due diligence trying to figure this stuff out. But, anytime I find some source that seems authoritative that says one thing, I'll find another that says something different. I can't tell if I'm misunderstanding what they're saying, or if there are just lots of different definitions for this stuff.
Here are a couple of our PSD plots.
Full Spectrum:

Zoomed in on the reference signal:


texts: Why is $y(t)=x(t/2)$ a non-causal system?

texts: I was going through my signal and system notes.they say $y(t)=x(t/2)$ is a non causal system? As non causal system depend on future inputs. how $t=t/2$ is future value of time? i could not understand how? could somebody please explain it to me?


texts: Ensemble learning, multiple classifier system

texts:
I am trying to use a MCS (Multi classifier system) to do some better work on limited data i.e become more accurate.

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.

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?

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.

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.

EDIT

I was told this may be a better place to ask this question from Stack overflow, original question:

https://stackoverflow.com/questions/9536786/ensemble-learning-multiple-classifier-system


texts:
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 Monstercat. 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.

For instance, higher (and, to a lesser extent, lower) frequencies are far 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?

For reference, here's a demo of my spectrum.


texts: Estimating the amplitude of a particular frequency

texts:
I am relatively new to DSP and have been reading a lot on the internet. I have a couple of questions.

I have a signal in the form of a function
$$
f(x) = A_0 + A_1 \cos(\omega_1 x) + A_2 \cos(\omega_2 x)+...+ A_n \cos(\omega_n x).
$$
I have $f(x)$ and I know the minimum and maximum frequencies. $f(x)$ can have really high frequencies.

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.

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?

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?

Thanks for answering!


texts: I possess a binary sparse symmetric matrix with square blocks centered on its main diagonal (white=0, black=1). These can be of any size and can overlap. I aim to detect centers of these squares using some image processing approach (red dots) in MATLAB. As the size of the matrix may get very large, techniques such as region growing while traversing the main diagonal is very inefficient. Can anyone have a suggestion on this?


texts: When is it possible to swap expander and compressor?

texts:
In the figure below I want to know when is it possible to swap expander and compressor so that the outputs remain the same?

I know in general it's not possible to interchange because neither expander nor compressor are TI but I know in some cases it's possible.


texts: How to figure out the polynom of Convolutional encoder

texts:
I have Convolutional encoder with K=7, r=1/2 that steam of bits get enter to it from right to left (7 registers and steam of input is entering the convolutional encoder from left to right .. )
the initial staes of 7 DD flip flops (registers ) are zero.
So I implemented it and I know how it works, I see the output!
How do I figure out what its polynomial(in other words the generator matrix ) ?
once I implemented the convolutional encoder I didn't use any generator matrix or whatever .. I used like memory registers variables and I was exchanging between the data synchronously to time ..
Any help please how can I figure out from the output of my implemented convolutional encoder its compatible polynomial (compatible generator matrix) ? is it possible to figure out the polynom from the output of convolutional encoder that I've implemented?
what's famous for K=7 the polynom [171 133] , but in my case the polynom is somethingelse because once I do  poly2trellis (7, [171 133]) in matlab it gives me wrong outputs unlike what expected ..
thanks alot!


texts: There is a mysterious factor when compute coeffiencts

texts:
everyone
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.

For example;

second order nominator a = [0,0976307608403291 0,195261521680658   0,0976307608403291] ,

denominator b = [1 -0,942806027702107   0,333329071063423]

when i do conv(a,a) in matlab result is

new_a  = [0,00953176546226155   0,0381270618490462  0,0571905927735693  0,0381270618490462  0,00953176546226155]

but i get this coeffs when i do butter func in matlab

butter_a = [0,0102094807912031    0,0408379231648125  0,0612568847472187  0,0408379231648125  0,0102094807912031]

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 ?

sorry for my bad language


texts: Find continuous signal given a condition on its samples

texts:
Let $x(t)$ be band-limited with $B = \omega_m$. Sampling gives us $$x(nT_s) = \begin{cases}
1,  & n = 0 \\
0, & n \not = 0
\end{cases}$$
And $\omega_s = 2\omega_m = \frac{2\pi}{T_s}$. Find signal $x(t)$.
My try: The first problem is about the definition for band-limited signal. It means $X(j\omega) = 0$ for $|\omega|\gt\omega_m$ or $X(j\omega) = 0$ for $|\omega|\ge\omega_m$? The sampling theorem requires that if $X(j\omega) = 0$ for $|\omega|\gt\omega_m$ then $\omega_s \gt 2\omega_m$ to avoid aliasing. So in this case is it possible to find interpolating functions other than $$x(t) = \begin{cases}
\frac{\sin(\omega_mt)}{\omega_mt},  & t \not= 0 \\
1, & t  = 0
\end{cases}$$which I've found using ideal low pass filter? I mean with the given information is $x(t)$ necessarily unique?


texts: Doppler Model, how does it affect the fading impulse response?

texts:
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

$$S(f) = \frac{1}{1+A\frac{f}{f_d}}\,\,\,\,\,\,\,\, |f|\leq f_{\max}$$

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?

Thanks


texts:
I am just begining learning about DFT and I am bit unsure on what is happening mathematically during DFT.

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.

The frequency resolution is 8000/205
where 205 is the amount of datapoint/samples and 8000 sample frequency.

I can by using the plot read, where |Ck| is highest and then using my frequency resolution, detemine the frequency.

I see that the amount  of samples have alot to say about determining the frequency.
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?

ex.

k := Round[1/((8000/100)/1000)]
freqres := 8000/100 // N
estimated freq = 468.293

k := Round[1/((8000/205)/1000)]
freqres := 8000/205// N
estimated freq = 992

k := Round[1/((8000/500)/1000)]
freqres := 8000/500
estimated freq = 992


texts:
The only 'authoritative' web reference (=very often linked) for calculating the coefficients for digital biquad filters seems to be this:

http://www.musicdsp.org/files/Audio-EQ-Cookbook.txt

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 ?

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 ?

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 ?

Here some other interesting info about Bandwidth (BW) and Q specifications

http://www.rane.com/note170.html

EDIT after answers

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.
BUT, in the example I have a singal with tho alternating sine wave with frequency 1000 and 3000 hz (FS is 44100):

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])

So I decide to raise the Q up to 20 to lowering the ripples, but all I obtain is this !
(bandpass biquad coeff: b=[0.0103, 0, -0.0103], a=[1.0, -1.8014, 0.9795])

Why the Q=20 biquad bandpass seems to raise the frequency in the bandstop instead of cut it off and why it spreads even more the center frequency ?
Why doesn't it make my signal sharper ?
Is there a way to mitigate these issues ?

Thanks for the help !


texts: recognize unwanted sounds, noises, and deleting them algorithm

texts:
I have a function that I need to use denoise algorithm on.

What I thought is to divide it to smaller parts and then use Fourier Transform on each one of the parts, but I am not sure what to do next.

Can you please help me and give me few algorithms to recognize noises, if possible algorithm that will fit the structure I described above?


texts: What is the difference between transport delay and dead time?

texts: 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?


texts:
I'm studying for my midterm , and I'm struggling with finding bandwidths.

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.

About the $90%$ % case, do I need to find the total energy and then  $\int_0^W \Psi(f) = 0.9 \times  Total Energy$?

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.

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$ ?

Thanks in advance, and sorry for the bad english.


texts: Why is it a bad idea to filter by zeroing out FFT bins?

texts:
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:

t = linspace(0, 1, 256, endpoint=False)
x = sin(2 * pi * 3 * t) + cos(2 * pi * 100 * t)
X = fft(x)
X[64:192] = 0
y = ifft(X)

The high frequency component is completely removed by this "brickwall" FFT filter.

But I've heard this is not a good method to use.

Why is it generally a bad idea?
Are there circumstances in which it's an ok or good choice?

[as suggested by pichenettes]


texts:
I implemented the algorithm to calculate 2D DFT derived from 1D DFT.
It works great, and makes my calculations much more efficiency then regular 1D DFT.

But now I want to make 3D DFT derived from 1D DFT and it doesn’t work for me. For 3 days I’ve tried to solve it, but I can’t, so I would like to ask you for help.

I make all math transforms by following the explanations in found in book “Theory and application of digital signal processing” Lawrence R. Rabiner, Bernard Gold - chapter 6.8 titled “A Unified Approach to the FFT“.

According to book example, let’s say we have $\ N=60 $ point signal. Let me remind definition of the DFT, which is:

$\ X ( k ) = \sum _ { n = 0} ^ { N - 1} x ( n ) W ^ { n k } $

$\ N=60 $ points we can expres as a $ 60= 5\times 12 $. So $\ n $ and $\ k $ can be written as:

$\ n = M l + m $

$\ k = L r + s $

Where:

$\ M = 12 $

$\ L = 5 $

$\ l = 0,1,..,L - 1 $

$\ m = 0,1,..,M - 1 $

$\ s = 0,1,..,L - 1 $

$\ r = 0,1,..,M - 1 $

So now we can write DFT as:

$\ X ( k ) = X ( L r + s ) = \sum _ { m = 0} ^ { M - 1} \sum _ { l = 0} ^ { L - 1} x ( M l + m ) W ^ { ( M l + m ) ( L r + s ) } $

And after some tweaking with power of W, we find that:

$\ W ^ { ( M l L r ) }  = 1 $

And we can write DFT as:

$\ X ( L r + s ) = \sum _ { m = 0} ^ { M - 1} W ^ {m (L r + s) } \sum _ { l = 0} ^ { L - 1} x ( M l + m ) W ^ { M s l } $

So great. Now I have 2D DFT, and it works great for me.

THE PROBLEMS STARTS HERE

Following my example with $\ N=60=5x12 $, we can see that 12 can be expressed as $\ 12=3x4 $.

So $\ m $ and $\ r $, which have values $\ 0, 1, …, M-1 $, we can express as:

$\ m = Z c + z $

$\ r = C v + y $

Where:

$\ Z = 4 $

$\ C = 3 $

$\ c = 0, 1, .., C - 1 $

$\ z = 0, 1, .., Z - 1 $

$\ y = 0, 1 , .., C - 1 $

$\ v = 0, 1, .., Z - 1 $

So now the $\ n $ and $\ k $ are:

$\ n = M l + Z c + z $

$\ k = L (C v + y) + s $

And then the DFT is:

$\ X ( k ) = X ( L (C v + y) + s ) = \sum _ { z = 0} ^ { Z - 1} \sum _ { c = 0} ^ { C - 1} \sum _ { l = 0} ^ { L - 1} x ( M l + Z c + z ) W ^ { ( M l + Z c + z ) ( L (C v + y) + s ) } $

And now after some tweaking with power of W, we find that:

$\ W ^ { ( M l L C v ) }  = 1 $

$\ W ^ { ( M l L y ) }  = 1 $

$\ W ^ { ( Z c L C v ) }  = 1 $

And finally we can write DFT as:

$\ X ( L (C v + y) + s ) = \sum _ { z = 0} ^ { Z - 1} W ^ {z (L C v + L y + s) } \sum _ { c = 0} ^ { C - 1} W ^ {c (Z L y + Z s) } \sum _ { l = 0} ^ { L - 1}x ( M l + Z c + z ) W ^ { M s l } $

And it doesn’t work for me, I have some crazy output values. And Have no idea if my math transforms (which I described above) are wrong, or maybe I just made wrong implementation. Of course I am not asking you about my implementation (which I haven’t shown here). First I want to be sure that my math transforms are OK?

For any help great thanks in advance.


texts: Guess the frequency response of a filter with little information

texts:
I have a processing unit that does a nice EQ filtering on soundfiles.
The only thing I can do is : I give the original .wav file, and the processing unit gives me back the filtered .wav. I have no other information than this.

I'd like to know the frequency response graph of this processing unit. How to do it ?

1) feed the unit with a "flat spectrum white noise", and see the spectrum of the filtered file? It works but it is not very accurate
2) feed the unit with sinewaves soundfile with frequency = 20, 30, 40, 50, etc... 20 000 Hz.
Then I examine the response for each file... and I can draw a frequency response graph after 10 hours of work :)
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 frequency response graph  ?
4) I imagine that there is another better solution?

Thank you.


texts: How to eliminate matched filter background?

texts:
The question

My goal is to detect an unknown frequency $f_1$ with a mixer and a matched filter. My simulation shows (below) that I correctly identify the 50 kHz external signal - but  it also produces extra signals, some of which I have as circled in red.

As you can see, the extra signal is significant - as big as 20 % of the peak detection. It also interferes with the height of the peak, which is critical for my application. These are my questions:

1. Where does this come from?
2. How to prevent it?

Background

There is a signal $s_1(t)=A_1\cos(2\pi f_1 t +\phi_1)$ with an unknown frequency $f_1$, phase $\phi_1$, and amplitude $A_1$. In this simulation, $f_1$ is between 45 and 55 kHz, or simply $45 < f_1 < 55$.

The scheme is to multiply $s_1(t)$ with a signal $n_{ramp}(t)$ that ramps linearly from 45 to 55 kHz over 10 seconds. When the two signals have the same frequency, a dc peak will be produced by the cosine product rule. Then, the signal is fed into a matched filter and a peak is produced corresponding to the external signal.

My scheme is summarized by this  diagram:

Code

I've made a MWE in octave:

clear all;
close all;
pkg load signal;

%Constants
sampleRate=0.00005;
time=0:sampleRate:10;
frequency=45+time;
phase=45*time + 0.5*time.^2;

% Signals
s1=cos(2*pi*50*time+pi/3);
n_ramp=cos(2*pi*phase);
s2=s1.*n_ramp;
s3=filter(fir1(500, 16*sampleRate*2,'low'),1,s2); %Low Pass Filter

% Matched Filter
r1=cos(2*pi*52*time);
ref00=r1.*n_ramp;
r2=cos(2*pi*52*time+pi/2);
ref05=r2.*n_ramp;
matched_filter=fft(ref00+i*ref05);

% Apply Filter and Plot
filtering=matched_filter.*fft(s3);
sout=shift(abs(ifft(filtering)),3/sampleRate);

figure
plot(frequency,sout/max(sout),'b-','LineWidth',1);
axis([45 55 0 1.1])
xlabel('Frequency, kHz', "fontsize", 15)
ylabel('Amplitude, a.u.', "fontsize", 15)
set(gca, "linewidth", 2, "fontsize", 12)

Thoughts

The extra signal detected is not noise; there is no noise in my simulation. Where does it come from? How can I prevent it from messing with the amplitude of my output?


texts: FIR filter design using Kaiser window - passband ripple and stopband attenuation

texts:
I have been given the following parameters :

lower cutoff frequency = $\pi/3$
lower cutoff freq = $2\pi/3$
beta = 5.6533
M = 51

Now I have to get magnitude and phase response of the filter using Kaiser Window and find the passband ripple and stopband attenuation in dB using a MATLAB program.
I have the following code. Can someone explain the following code?
Wl=1/3;
Wh=2/3;
M=51;
alpha=5.6533;

width=(0.4465/pi);

Whs=Wh-(width/2);
Whp=Wh+(width/2);
Wlp=Wl-(width/2);
Wls=Wl+(width/2);

order=M-1;
b=kaiser(M,alpha);
disp('Filter');
sys = fir1(order,[Wl Wh],'stop',b)
freqz(sys);

[h w]=freqz(sys,1,1000,'whole');
mag=abs(h);
db=20*log10(mag+eps/max(mag));
normalized_delta_w=2/1000;

Ap=-(min(db(1:1:floor(Wlp/normalized_delta_w))));
disp('Passband ripple (dB)');
disp(Ap);

As=round(max(db(ceil(Wls/normalized_delta_w+1):1:ceil(Whs/normalized_delta_w))));
disp('Stopband attenuation (dB)');
disp(As);


texts:
I have 2 frequencies in my application: $12000\mathrm{Hz}$, $13000\mathrm{Hz}$.
I want to set a parallel Goertzel filters and every 100ms I want to take the bigger magnitude for detecting the tone received.

Is there any way to implement this?  That is, how can I evaluate two functions in parallel in C#?

I work on WPF, C#

Thanks


texts: Kalman Filter: Effect on covariance from frauded errorneous sensor

texts:
I have recently started to learn about Kalman filters and I am right now simulating a very simple model in Simulink giving a noisy sinewave (position) and its derivative (speed). I have implemented/parameterized two redundant filters:

The Kalman Filter Block included in the control system toolbox (Simulink)
A matlab function using mainly the code given on this site: https://www.cbcity.de/das-kalman-filter-einfach-erklaert-teil-2

As both ways give plausible and equal results, I assume no major bug in my implementation.

I assume both states to be measureable. However, if I falsify one of the measured states to a completely stupid value, the value of the covariance and Kalman gain stays constant (after it converged to a fix value from its initial state). From my understanding, the values should change as less confidence can be put into the falsified state.

Is this expectation correct?

Thanks for your help.

Phil


texts: 2D-otsu algorithm in Digital image processing

texts: I'm working on image project using Matlab & 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.


texts: Determining window Size for Savitsky-Golay filter (Savgol_filter)

texts:
First, I am aware that an ideal optimal window task is really signal/task-specific, i.e. nature of signal/sampling rate/characteristics of interest etc.

What I am interested in: "Is there an optimal guideline and way to determine window size for the use of the Savitsky-Golay filter (Savgol_filter)?

For example. If I want to determine the cut-off frequency of a Butterworth filter, I first do a residual analysis of the signal to determine the residuals and noise and therefore cut-off frequency as described in Winter DA (2009) Biomechanics and motor control of human movement. 4 ed. Hoboken, EUA: Wiley.

Is there a similar way to determine the optimal or minimal window size when using the SG filter?
What I do is to start with a window size of 3 and go higher until I find it smooth enough to identify what I want (e.g. extremum) without over smoothing etc. Is there a more scientific way?

The signal I am working with is gross motor/movement signals in humans.

Thank you in advance for your help.


texts: How to Tell How Likely a Signal Is Present in Another One (Variance Unknown)?

texts:
I know this is probably a simple question, but I haven't been able to find a satisfactory answer anywhere...

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.

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%.

Some notes:

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.
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.
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?
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.

Thanks!! Any thoughts any of you have on this would be greatly appreciated!


texts: Spectrogram, time vs frequency localization, and length of signal

texts:
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.

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}$$

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.

$$ f_s = 2 \times ({74767 \times 0.5 \over X}) $$

I'm having two issues however with this.

The first is that I'm slightly confused about the frequency resolution and number of bins for my spectrogram.

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 always be 2 because the frequency resolution is: $$ freq_{res} = {f_s \over N} = {1 \over T}  $$

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!

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:

$$ 3000 Hz = 2 \times ({74767 \times 0.5 \over X}) $$

$$ \therefore X = {{74767 \times 0.5} \over 1500 } \approx 25$$

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.

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.

N = 3000

N = 8000

N = 1495. X = 25

Plain-text Link for image found here: i.stack.imgur.com/1HLTL.png

(I don't have enough Karma to post more than 2 links).

TFT Toolbox: tftb.nongnu.org/


texts: Applying Viterbi algorithm to compensate for ISI in PSK31

texts:
I am implementing a receiver for the amateur radio mode PSK31. It is effectively a BPSK modulation with a pulse shape of a raised cosine twice the width of one symbol. Here are four consecutive pulses, with 4 samples per symbol, as they would be transmitted:

The trouble is matched filtering introduces ISI. 4 pulses again, after a matched filter in the receiver:

If my understanding is correct, the issue here is one pulse is non-zero at the ideal decision point of the adjacent pulses.

However, my thinking is this is predictable, and the interference never extends beyond the adjacent symbols. So if the previous and next symbols are known the ISI can be cancelled by subtraction of the interfering adjacent pulses.

The trouble is the previous symbol isn't known with certainty. I think the Viterbi algorithm is a possible solution. And I've watched some videos on the algorithm and think I understand how the algorithm works, given a particular trellis.

What I don't understand is how to apply the Viterbi algorithm to this particular problem. The material I've found is either theoretical with math that blows my head off, or some other application of the algorithm. Could someone please provide an intuitive, practical explanation in this context?


texts: 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.


texts: Can we differentiate between observed sequences of IID and uncorrelated noise?

texts: Given a realization $\{z_{i}\}_{i}$ of some noise process $\{Z_{i}\}_{i}$ that is either a White-Noise process or an IID process, i.e. both are uncorrelated however the former also is independent, can we determine which one it is?


texts: Example of Entropy and Channel Capacity Computation

texts:
Can you help me on verifying if this computation of entropy is correct and on understanding its meaning?

I am not sure of the result especially because it is equal to 0: it means that we cannot transmit any bits/s on that channel. Why?


texts: difference (or relationship ?) between power spectral density, power density function and periodogram

texts: 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?


texts:
I have consulted the almighty oracles of google and wiki, but I cannot seem to find a definition for the phrase "the moment of the spectrum".

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:

$$ N_0 = \frac1{\pi} \left(\frac{m_2}{m_0}\right)^{1/2}$$

It then goes on to further define the number of extrema per unit time as given by:

$$ N_e = \frac{1}{\pi}\left(\frac{m_4}{m_2}\right)^{1/2}$$

where it goes on to finally say, "where $m_i$ is the $i$th moment of the spectrum."

Anyone encounter this before? What is the "moment" of a spectrum? I have never heard of it in the DSP literature before.


texts: When Is a Power of 2 FFT Slower than Smaller Sized Non Power of 2 FFT in MATLAB

texts:
Knowing that computing an FFT is faster if the amount of samples is a power of 2 I have always tried to pad the inputs to Matlab's FFT with zeros until the next power of 2 is achieved. Matlab's function fftfilt which implements a FIR filter with the overlap-add method does the same, selecting the FFT size as 2^nextpow2(FIR_coeff + input_signal-1).

However I realize that if the amount to be padded is too long compared to the original size this my actually be inefficient. For instance if a 130000 samples FFT was to be computed. Assuming a huge and unpractical single FFT was carried out. As the next power of 2 of 130000 is 131072 maybe despite adding 1072 zeros it would be more efficient than performing the 130000 samples FFT directly. The worst case would be having (power of 2) + 1 samples and trying to pad to the next power of 2, specially if the number of samples is large. For instance in my example having 131073 samples which next power of 2 is 262144 would add 131071 zeros! Starting at which point in terms of ratios between original size and padding size would it be better not to pad? I'm looking for a practical and approximate idea. Let's say something like: do not pad if you are adding more than 5% of original size in zeros.


texts: Low order sinc interpolation vs. polynomial interpolation for variable fractional delay

texts:
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.

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.

I really like sinc interpolation because it offers two advantages over polynomial interpolation.

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.
Coefficients are independent of interpolation order. For polynomial interpolation you need precomputed polynomials in the delay amount for all the orders you might need.

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.

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?)


texts: Recovering a DSSS signal with poor clock synchronization

texts:
I've run a lot of simulations and it seems like DSSS is just as noise resistant as people say it is. Resistant from jamming and even it seems some fading and narrow-band interference. I'm doing this simply by signal correlation - taking the FFT of the desired signal, and the FFT of the demodulated signal, multiplying in frequency space and IFFT'ing to look at the output in linear time.

I'm interested in running a VERY low data rate (<100 bps) but moderately wide-band signal (~2.8 MHz bandwidth), as to minimize impact on the spectrum and being able to recover the signal in extremely poor quality. I'd also like to maintain a very high degree of signal orthogonality to other sources. This would mean a very long chip sequence (I'm hoping for 4096 or so).

I'd like to do this so all communications can pass over the DSSS path. Everything seems to work perfectly so long as the clocks remain perfectly (or almost perfectly synchronized).

If I have my clocks out by as little as 40 ppm, it seems to start confusing the end and beginning of the chunks. The only way around this I can think of is run several decoders, each at a slightly different chip frequency and seeing if any of the detectors get a match.

ACTUAL QUESTION: Is there any magical way to recover a DSSS signal with poor synchronization this that doesn't take a linear number of logical receivers over the frequency space?


texts:
Let $\mathcal{L}$ be a stable LTI system. Is it true that if input has finite energy then output also has finite energy? I'm not sure about that. We know that $$\int_{-\infty}^{+\infty}|h(t)|dt\lt\infty \tag{1}$$Where $h(t)$ is the impulse response. Also we have $$\int_{-\infty}^{+\infty}|y(t)|dt = \int_{-\infty}^{+\infty}|Y(s)|ds = \int_{-\infty}^{+\infty}|X(s)||H(s)|ds \tag{2}$$Since $y(t) = \mathcal{L}(x(t)) = x(t)\star h(t)$ which implies $Y(s) = X(s)H(s)$. Applying Cauchy–Schwarz inequality to $(2)$, $$\left(\int_{-\infty}^{+\infty}|X(s)||H(s)|ds\right)^2 \le  \left(\int_{-\infty}^{+\infty}|X(s)|^2ds\right)\left(\int_{-\infty}^{+\infty}|H(s)|^2ds\right) \tag{3}$$We know that $$\int_{-\infty}^{+\infty}|X(s)|^2ds = \int_{-\infty}^{+\infty}|x(t)|^2dt<\infty$$Since input is an energy signal but $$\int_{-\infty}^{+\infty}|H(s)|^2ds$$doesn't necessarily exists. So is this indicates that we can find a counterexample to the statement or we can prove that by other methods?
Edit: Here is a counterexample which shows $$\int_{-\infty}^{\infty}|h(t)|dt\lt \infty \nRightarrow \int_{-\infty}^{\infty}|h(t)|^2dt\lt \infty$$


texts:
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.

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.

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).


texts: When and how can multiple EQ filters be merged into one?

texts:
As I understand it, it should be possible to merge similar filters, e.g. if I have two shelving filters with the same Q and frequency but different gains, I can just merge them into one by adding the gains, and it will have the same effect as two. Is this correct?

In what other cases is this possible?


texts: Received signal's power under Raleigh fading

texts:
I am trying to understand how to calculate the power of a received signal under Raleigh fading.
What I gather is that the Rayleigh fading is a complex Gaussian random variable and that the multipath components are summed.
I also understand that the fading is applied at the symbol level.
Would it be possible to calculate the received power of a signal without having to deal with the number of symbols transmitted in that signal?
So, I have made a mini working example in MATLAB.
R = 500; % Cell radius in meters
eta=4; % path loss exponent
P_BS = 251.189; % BS transmission power in mWatts
D_BS_to_UE = 450; % Distance between UEand BS in meters

N_multipath = 3; % Number of multipaths
h = (randn(1,N_multipath))+1i*(randn(1,N_multipath)); % Rayleigh Fading

P_received = sum(abs(h./sqrt(2)).^2) * P_BS * D_BS_to_UE.^(-eta)

I guess what I am trying to understand are the following:

Whether the sum(abs(h./sqrt(2)).^2) is correct as it concerns the signal in its entirely and not per symbol.

What is the value of N_multipath that can be considered practical? Is there a way to calculate that or is it arbitrarily chosen as I have done?

I have also seen a discussion on taps. What I gather is that it entirely depends on frequency-selective or flat fading. If flat then one tap, if frequency-selective then more than one tap. How do I add the taps if I choose frequency-selective?


texts:
A plot showing two S21 peaks through a resonator is given below:

As you can see, the first resonance peak occurs at 4.43GHz. The fit applied to this peak is given below.

$$y = A - 10 \log_{10} {\left[ 1.0 + \left( 4Q^2 \left(1-\frac{\omega_d}{\omega_0}\right)^2\right) \right]}$$

This fit gives a nice curve and physically sensible values of $A$, $Q$ and $\omega_0$.

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.

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.

Cheers for any ideas.

Also, if anybody has any ideas why such a resonance peak takes the form of that at 4.99GHz, please share.


texts: Raised-Cosine Filter - calculating phase response

texts:
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).

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:

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++.


texts: My time-domain sampling rate of IQ data is Fs. Matlab FFT assumes spectral bandwidth is Fs/2, per the Nyquist criterion. I understand that IQ data has bandwidth of Fs. How do I do FFT of such IQ data and get bandwidth of Fs?


texts: Regressing/interpolating between quasi-periodic sinusoids

texts:
This is a cross-post (on recommendation) from CV.

My problem is very simple.

I currently intend on using Kriging (Gaussian process regression) to perform regression between the trajectories marked with red dots on the below plot, where a simple linear-regression surface has been superimposed as well.

As you can see there is a strong correlation in a particular direction of the four time-series.

Through long and very interestind discussion with @DeltaIV, we started consdering other methods such as harmonic regression. The latter would have been very elegant except the example time-series in the above plot have different periods (fundamental frequencies) thus HR will not work.

Hence I would like to ask you excellent people what you would recommend for either regression or interpolation between quasi-periodic time-series such as the above? I should not that the above plot shows only one period, that approximately repeats itself but not quite (hence 'quasi').

Alas currently (in order of preference):

Multivariate splines (recommendations here welcome too)
Gaussian process regression (with complex kernel choice)
Some magical way of making harmonic regression work with time-series with different periodicity

UPDATE:

Here is another image, showing the periodicity of ONE of the signals annotated by the red dots above. Thus, this time-series shows the periodicity of the time-series over a longer period of recorded time. Again, this is just ONE of the above four time-series, recorded at a certain regime.


texts: Executing a command based on a Short-Time Fourier Transform Output

texts:
I am currently calculating a Short-Time Fourier Transform (STFT) in Python using scipy.signal.stft.  I am producing the image of the STFT shown below in real-time, based on the data that I have streaming in.

I am looking to trigger an event warning when the frequencies detected are similar to those after the 50th time segment.  I want the event warning to neglect the events that you can see before the 30th time segment.

One idea that I have had are as follows:

Calculate the length of the time segment where certain frequencies are present.  And if the time is less than a few time segments, then I should disregard them.  However, if the time segment at that frequency lasts longer than, let's say, 10 segments, then I should produce the event warning.

Any other ideas, or help is greatly appreciated!

The STFT is being called as follows, and I have my data streaming in from a sensor.
f, t, Zxx = scipy.signal.stft(data['Z'], fs=250, nperseg = 50)

The x-axis is the array of segment times.  The y-axis is the array of sample frequencies.


texts: Length and spacing autocorrelation with FFT

texts:
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.

What is the resolution of the autocorrelation? Is it $\frac{\Delta T}{2}$?

What is the time interval of validity of the calculated autocorrelation? $[0, N]$ or $[0, \frac{N}{2}]$?


texts:
I am studying DFT of sinusoids, and my professor gave me this signal.

Sinusoid Frequency: 100Hz
Number of Samples: 512
Sampling Rate: 8 kHz

Plotting the spectral plot I have the following:

I was expecting a single peak initially since the signal is only composed of a single frequency but from my understanding of the DFT, it mirrors the positive and negative values from the Nyquist rate which is 4kHz hence resulting to the two peaks. My professor then asks to 'correct' the peaks by modifying the parameters of the sinusoid. I am just confused as from what I understand the resulting peaks are correct.


texts:
As I understand it, in MRI, a line in k-space is usually acquired while the readout gradient is applied. So during the application of this gradient the protons spin at different frequencies along the gradient.

Now, I sample the MRI signal during the application of this gradient. My confusion is that I can sample the signal at arbitrary resolution and the inverse FFT will produce the image with as many pixels as the sampling resolution.

To make the question a bit concrete. let's say I have simulated 128 spins at a distance of 1 mm apart. This will give me an object with the FOV of 0.128 meters.

Now say during the readout I sample 10000 equidistant points. So, effectively I have collected 10000 complex k-space values. An inverse FFT would also give me an image with 10000 pixels. Now, how do I resolve this 10000 pixel image into a 128 pixel image where each pixel corresponds to the corresponding spin.


texts:
I have performed a STFT for signals and obtained the amplitude through
S = librosa.stft(y=y_cut,n_fft=n_fft,win_length=n_fft,hop_length=n_fft,window='hann',center=False)

Here i have 4097 rows for S (1 + NFFT/2) and 12 colums (time periods).
I want to obtain the PSD from this. PSD is the square of magnitude, but I have values over time period and I have to take mean of them. I have 2 methods to proceed.
Method 1: Taking amplitude mean in the time frames and then squaring the amplitude
Abs_mean = np.mean(Abs, axis = 1) # Mean
Power_dB =librosa.power_to_db(Abs_mean**2)   # dB

Method 2: squaring the amplitudes and then taking the mean of power
Power_mean = np.mean(Abs**2,axis=1) # Mean of amplitude^2
Power_dB =librosa.power_to_db(Power_mean) # dB

Which method is correct?


texts: Continuous wavelet transformation has been quite widely used for various applications. Most of the papers that I found were using CWT for non-stationary signals. Can we use CWT for stationary signal analysis? if not what are the drawbacks in using Continous wavelet transform?


texts:
Woud anyone have a viterbi decoding tool or c-code or .m file for (R=1/2, K=4)?
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.
Regards
Vangelis


texts: How do I implement LIBSVM for multiclass classification using java?

texts: 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?


texts: When can a windowed cosine be considered band-limited signal?

texts:
I have an exam in the following days and i have no clue of what is the response to this question in the exam:

  given this signal:

  $$g(t) = H\left(t+\frac{T}{3}\right) f(t) - H\left(t-\frac{2T}{3}\right)f(t)$$ $H(t)=$ Heaviside step function

  $f(t) = \cos(\omega_1 t)$

  Define a value of $T$ for which the signal $g(t)$ can be considered
  band limited.

This question doesn't make much sense to me. This is a windowed cosine function and it's bandwith depends on the value of $T$, it's always limited!
Unless $T$ approches 0 and it can be seen as an impulse. Am I missing something?


texts: Pose-invariant face detection and recognition

texts:
I would like to detect faces and later apply recognition algorithms to surveillance videos. Ideally, the application should run in real-time (or near real-time) and transfer the data first to an algorithm deployed on cloud (or on a powerful server) to perform face detection/recognition and give a list of likely/best-matching candidates.

Here is an example image which is similar to the images from the videos on which I would like to run the detection and recognition algorithm.

Of course, it is assumed that the person's face will (at least partially) turned towards one of the deployed cameras. However, unlike the usual benchmarks and datasets used in face detection/recognition papers, under real-world conditions, one rarely has a full frontal view of a person's face. In the best case, there are slight tilts in vertical direction (pitch), and in most cases there is also a tilt in the horizontal direction (yaw). Another challenge is the bad lighting conditions and variations in lighting (plays a role when one wants to do matching among faces detected in different environments).

What kind of robust algorithms exist in the literature for face detection and recognition that can operate on faces that do not necessarily have a frontal pose. Are deep learning based algorithms robust in terms of dealing with pose variations for the same identity? I can imagine that this problem is easier to solve for face detection but could be very challenging for face recognition/verification. Does anyone have practical experience with such algorithms and use them on real-world data such as surveillance videos?


texts: Length of frames for calculating cepstral coefficients

texts:
For audio classification we are using the cepstral coefficients and their derivatives. Which I calculate using the Matlab libary voicebox.

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?


texts: Determining Optic Flow - Horn and Schunck - robust/insensitive to …

texts:
Can somebody explain to me why the Horn and Schunck algorithm (probably mostly the smoothness constraint) is robust to image sequences that are quantized rather coarsely in space and/or time. (Thought that is only the case when I use a multi-resolution approach)
Also it is insensitive to additive noise and quantization of brightness levels. It calculates the optic flow with a Laplacian of the flow velocities so that the complete image should have an effect on each image gradient vector.
But isn't this a reason that the algorithm is robust to these characteristics?

Please provide a detailed explanation. If i've made mistakes by explaining my problem please point it out, this method is still very difficult for me to understand in detail.


texts: In a communications system does the order of channels is in a cascaded channel affect the overall capacity?

texts:
I'm currently looking at capacity for cascaded channels as part of my Communications Systems module and we're looking at a question in which we have four identical channels represented by the conditional probability function given in a matrix:
p(y|x) =
|0.9 0.06 0.04|
|0.04 0.9 0.06|
|0.06 0.9 0.04|
Then another channel:
q(y|x) =
|0.98 0.01 0.01|
|0.01 0.98 0.01|
|0.01 0.98 0.01|
As far as I could tell the capacity didn't change whether q was in position 1 in the cascade or position 5 in the cascade. I also tried some different matrices that didn't resemble the identity matrix so much and again I found position didn't matter and I was wondering why this is?


texts:
For the differential equation
$$\frac{d^2y(t)}{dt^2}+\frac{3dy(t)}{dt} + 2y = x(t),$$

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.


texts:
What is the relation between time, frequency, spatial and spectral domains?

I think that time and spatial domains are the "original" domains (e.g. if the signal is a greyscale image, then the domain would e.g. be all possible grey intensities for all pixels), whereas the frequency and spectral domains are the "Fourier" domains, that is, the domains of the functions after having applied the Fourier transform to the original function or signal. Is this right?

I also think that we use spatial when the input, in the original domain, are images, whereas we use "time" in a more general sense, but maybe we should be using it only when the original domain only represents time (we could say a similar thing regarding the frequency domain). The spectral domain, I think, is a more general term, which refers to the domain after having applied the Fourier transform, so it can e.g. refer to the frequency domain. Is this right?

I am more interested in knowing the meaning of these concepts in the context of image processing and computer vision. I think it would be interesting to have a diagram that explains the transitions between these domains (using e.g. the FT).


texts: Logarithmic vs Nth root transformation of Image

texts:
This is an image for the explanation of Logarithmic Transformation of an Image. I want to ask considering a input pixel value rk, Value of nth root of rk should be greater than corresponding value of log(rk). But this image is not accordance with that?

Can someone explain ?


texts: Where to start in the design of my filter to remove 50 Hz

texts:
pick any 3 random files from this database, : https://physionet.org/pn3/ecgiddb/
They are subject to 50 Hz powerline interference.

We wish to convert from time domain to frequency domain and remove the 50 Hz frequency then transfer back to time domain showing clean signal.

I'm looking for some pointers in how I go about designing a Butterworth low pass filter which will eliminate 50 Hz powerline interference from an ECG.

How do I determine which order of filter, and how I determine the poles and zeros in order to calculate magnitude, phase and  filter coefficients. Where do I start?


texts: Source Localization with the BLUE Estimator

texts:
I'm trying to implement BLUE estimator in MATLAB for source localization and after my research I've come up with a theoretical example in Steven Kay's "Fundamentals of Statistical Signal Processing: Estimation Theory" book (Example 6.3).

In this solution, while estimating $\theta$, the Gauss-Markov theorem is used and a point called as nominal source position($R_{n_i}$) is defined rather than real source position($R_i$). There is equation which shows the relation between $R_{n_i}$ and $R_i$ found by first order Taylor series expansion.

I'm confused about finding the value of $R_{n_i}$ variable, can anyone explain me this solution?

This could be a very simple question, but I want to understand the theory and my mind is not clear now. When you look at the solution in the book, I think you will understand better than I wrote.

EDIT:

N = 8; %total number of receivers
var = 1;
c = 3*10^5; % speed of electromagnetic waves
x = [0 8 7 1 5 9 3 1]; %xi receiver location
y = [0 1 9 9 2 5 8 4]; %yi receiver location
xs = 3; ys = 6; %real source location
xn = 6; yn = 10; %nominal source location
Sxs = xs-xn; Sys = ys-yn;
for i=1:N
    R(i) = sqrt((xs-x(i))^2*(ys-y(i))^2);
    Rn(i) = sqrt((xn-x(i))^2*(yn-y(i))^2);
    co(i) = (xn-x(i))/Rn(i); %cosai
    si(i) = (yn-y(i))/Rn(i); %sinai
    noise(i) = var*randn(1,1); %e1,e2,..
end
for i=1:N-1
    e(i) = 1/c*(co(i+1)-co(i))*Sxs+1/c*(si(i+1)-si(i))*Sys+noise(i+1)-noise(i); %linear model (6.26)
end
H = 1/c*[co(2)-co(1) si(2)-si(1);
         co(3)-co(2) si(3)-si(2);
         co(4)-co(3) si(4)-si(3);
         co(5)-co(4) si(5)-si(4);
         co(6)-co(5) si(6)-si(5);
         co(7)-co(6) si(7)-si(6);
         co(8)-co(7) si(8)-si(7)];

A = [-1 1 0 0 0 0 0 0;
     0 -1 1 0 0 0 0 0;
     0 0 -1 1 0 0 0 0;
     0 0 0 -1 1 0 0 0;
     0 0 0 0 -1 1 0 0;
     0 0 0 0 0 -1 1 0;
     0 0 0 0 0 0 -1 1];
inaaT = inv(A*transpose(A));
estTheta = inv(transpose(H)*inaaT*H)*transpose(H)*inaaT*transpose(e); % eq. 6.27

This is not a modular code, I just want to be sure about not missing any point. However, when I run this code I get useless estTheta values. I think again I leave out something in the theory.


texts: Understanding Matlab's Automatic Gain Control function

texts:
I am trying to understand the automatic gain control block provided by the communications toolbox. The documentation is here: Documentation

My questions are in regards to two of the configurable parameters, the
DesiredOutputPower and MaxPowerGain.

Given a value X for DesiredOutputPower, how does one compute what the reference value A is?

Given a value X for MaxPowerGain, how does one compute what the upper limit for g is?

For example:

If DesiredOutputPower = 2 then A = 0.693147180559945

If DesiredOutputPower = 6 then A = 1.791759469228055

And

If MaxPowerGain = 10 then the upper limit for g is 1.15129255

If MaxPowerGain = 60 then the upper limit for g is 6.90775527

The documentation in regard to DesiredOutputPower states:

  Specify the desired output power level as a real positive scalar. The
  power is measured in Watts referenced to 1 ohm. The default is 1.

And in regard to MaxPowerGain:

  Maximum power gain in decibels

  Specify the maximum gain of the AGC in decibels as a positive scalar.
  The default is 60.

How are these numbers determined?
What are the formulas? I've been trying to apply the formulas I read here:
The dB in Communications
but I havent been able to figure it out, please help.

Thank you!


texts: Why Sparse Priors Like Total Variation Opts to Concentrate Derivatives at a Small Number of Pixels?

texts: 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.


texts: Matlab code for Simulating of Phase Noise for OFDM systems

texts:
I am trying to simulate phase noise for OFDM systems.
I have been reading about phase noise, some literature suggests that phase noise is cumulative as follows:

$\phi(n)=\phi(n-1)+\omega(n)$

where $\omega(n)$ is a Gaussian random variable.
The received OFDM signal is expressed as:

$r(n)=x(n)e^{j\phi(n)}$
where $x(n)$ is the transmitted OFDM signal.

I am looking for Matlab code for phase noise simulation.
thanks


texts: Confusion regarding plot of linear convolution vs fast convolution via FFT

texts:
I am reading Proakis Digital signal processing using Matlab, 3rd edition
I am performing example 5.23 but i am not getting same plot/results as book although i am using almost same code
First i am attaching my code and output and then i will attach snapshot of book containing code and output
The issue with book code is that , i get error for "nu" variable and matlab says "NI" is undefined(i have underlined NI in book snapshot with red paint pencil)  , so i used "NL" in my code and "NL"=N*L ,but i am not getting output as book
My code is as follows
clc;clear all;close all;
conv_time = zeros(1,150); fft_time = zeros(1,150);
%
for L = 1:150
tc = 0; tf=0;
N = 2*L-1; nu = ceil(log10(N*L)/log10(2)); N = 2^nu;
for I=1:100
h = randn(1,L); x = rand(1,L);
t0 = clock; y1 = conv(h,x); t1=etime(clock,t0); tc = tc+t1;
t0 = clock; y2 = ifft(fft(h,N).*fft(x,N)); t2=etime(clock,t0);
tf = tf+t2;
end
%
conv_time(L)=tc/100; fft_time(L)=tf/100;
end
%
n = 1:150; subplot(1,1,1);
plot(n(25:150),conv_time(25:150),n(25:150),fft_time(25:150))

My output/plot snapshot is follow

[![enter image description here][2]][2]
Following is book snapshot
[2]: https://i.stack.imgur.com/1wPVM.jpg


texts: What is "feature indexing" in image processing?

texts: What does "feature indexing" 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.


texts: Find Fourier Transform of signal that satisfies this equation

texts:
I have attempted it this way:

$G(j\omega)$ is a rectangular pulse in frequency domain. Using results, inverse Fourier transform of $G(\omega)$ will be $$g(t)=\frac{\sin(2t)}{\pi t}$$

Now given that $g(t)=x(t)\cos(t)$

Using $\sin (2t)=2\cos(t)\sin(t)$, I got $$x(t)=2\frac{\sin(t)}{\pi t}$$

But, I am struggling to draw the parallel for part b of the question.

I was using the multiplication property for part b, and it turned out,

$$G(j\omega)=\frac{X\left(\omega-\frac 23\right)+X\left(\omega+\frac 23\right)}{2}$$

How to find $X(\omega)$ and proceed from here onwards?


texts: What is the deffinition of convexity defect in image processing?

texts:
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?

Thank you.


texts: Multipath fading in wireless channel - parameter needed

texts:
I’m trying to implement in Matlab the magnitude of the channel taps of the wireless communication system that is described at page 23 (Section 2.1.4) in the classic book of D. Tse, Fundamentals of Wireless Communications.

The $l^{\rm th}$ channel taps at time $m$ is given by eq. (2.51) p. 44:

$$
h_l[m] = \sum_i a_i\left(\frac mW\right)e^{-j2\pi f_c \tau_i\left(\frac mW\right)} \mathrm{sinc}\left[l-\tau_i\left(\frac mW\right)\right]
$$

In this particular case we have $i = 2$ paths and attetuation $a_i(t)$ for these paths are given from eq. (2.15):

$$
a_1(t) = \frac{\lvert\alpha\rvert}{r_0 + vt}, \quad a_2(t) = \frac{\lvert\alpha\rvert}{2d - r_0 - vt}
$$

And propagation delays by eq.(2.16):

$$
\tau_1(t) = \frac{r_0 + vt}{c} - \frac{\phi_1}{2\pi f }, \quad \tau_2(t) = \frac{ 2d -r_0 - vt}{c} - \frac{\phi_2}{2\pi f}
$$

I have calculated everything apart from $\lvert a\rvert $. I don’t really know how to calculate it.

Any suggestions?