I have a 10x1100 matrix, which represents the coefficients of a scalogram for a signal of 1.1sec duration at 1kHz sampling rate. The scalogram has 10 frequencies, so basically the rows of the matrix are the frequency bins and the columns are the time points.
And then I want to resample that matrix to form a 10x10 matrix. To be more specific, what I want to do is the following (part of a paper I'm working on):
"The scalogram was then resampled at 10 time lags (t−100ms, t−200ms,...,and t−1s) to form a 10×10 scalogram matrix of time t."
So, how exactly should I make that resampling? I am aware of the Matlab functions downsample, resample, decimate, but I am not sure about the way I should resample that matrix. Should I just take every 100th element of my initial matrix or should I use the decimate function which also filters the signal? And if not the first case, how can I make Matlab resample at those specific 10 time lags?
Related
I use the matlab software. To my question.
I have a audio signal, on which i am applying a STFT. I take a segment
(46 ms, specifially chosen) out of my signal y(audio signal) and use a FFT on it. Then i go to the next segment, until to end of my audio signal.
My WAV-File is 10.8526 seconds long. If I have a sample frequency of
44100Hz, this means my y is 10.8526*fs = 478599.66 which is
shown in the workspace as 478 6000 x2 double.
The length of my fft is 2048. My signal are differentiated under lower frequency band [0 300], mfb [301 5000] and hfb [5001 22050(fs/2)].
The bands are just an example and not the actual matlab code. Basicall what i want (or what I am trying to do), is to get the values of my bins in the defined frequency band and do a arithmetic mean on it.
I chose 46 ms because, I want it as long as the fft length, or nearly as long as the fft. (It is not exact).Afterwards, I want to try plotting it, but that is not important right now. Any help is appreciated.
Fourier transform of a signal in time domain in a vector of size n will return another vector of size n of same signal but in frequency domain.
Frequency domain will be from 0 (dc offset) to your sampling frequency. But you will only be able to use half of that. Second half would have same values but mirrored.
You can obtain the center frequency of each useful bin with:
f = Fs*(0:(n/2))/n;
This question already has answers here:
How do I obtain the frequencies of each value in an FFT?
(5 answers)
Closed 6 years ago.
I have a data set in a matrix in matlab. It contains 25,000 values taken every 0.5 ns; so the total time of the dataset is 1.25E-5 seconds.
The data set contains very high frequency noise that I am not interested in so I create another matrix is every 50th data point from the first matrix So the size of the matrix is 1000*.
I plot the absolute values from matlab's fft this matrix (I also normalise the amplitude and only plot the first half) and get the attached (two plots, second is a close up of the low frequencies I am interested in). How do I convert the x-axis to frequency?
Another point, if I take every data point (so I create an fft of the entire 25,000 points) then the x-axis is exactly the same; in other words, the size of my matrix seems to have no bearing on the x-axis returned by matlab. I've attached two links to the frequency spectrum, one of which is a close-up of the low frequencies I am interested in. It's axis goes from 0-50, so it is these values I need to convert to Hz.
Thankyou in advance!
Close up of frequency spectrum
frequency spectrum
From what I read on http://www.mathworks.com/help/matlab/math/fast-fourier-transform-fft.html#bresqop-1, it appears that the units on the x-axis of the plotted FFT are Hz if the first vector, f, you put into the plot(f,power), is defined as a sequence of n elements (n being the number of data points put into the FFT) increasing from zero to the sample frequency.
Thus, for the first plot, which used every 50th of points that were taken at a frequency of 2 GHz, the sample frequency would be 40 MHz. Thus, f = (0:n-1)*4*10^7/(25000/50)
It goes on to show how to use the fftshift function to put the center of the output of the fft function at 0, but it's clear you already did that and chopped off the negative part.
So, once you have the right separation of fs/n, sampling frequency divided by number of data points used, in the vector that supplies the x-axis to the plot function, then the units of the x-axis will be Hz.
(I hope you still have the numbers to graph again? If not, this question might help: Confusion in figuring out the relation between actual frequency values and FFT plot indexes in MATLAB)
I am sorry to ask a basic question. I am new in signal processing and want to know about the difference between PSD and fft.
I have a audio signal. Which I convert into PSD by using pwelch in matlab. But, when I plot this signal, I want to see the frequency (hz) in x axis and energy (db) in y axis.
But, it doesn't show like this way.
Can anybody explain me the relationship between PSD and FFT and also please let me know, how to plot these two things.
Thanks
To put things simply (for the first pass), the FFT is an algorithm that implements the Discrete Fourier Transform (DFT). The DFT takes N points of the input signal and performs a fourier transform. Power spectrum of the signal is got after you plot the square of the magnitude of the FFT output.
So, the DFT takes N points as input and spits out N points as the output. If you think of the signal as a frame of N samples, the DFT finds statistics using only one frame (N points).
However, the pwelch method is an average statistic over multiple frames. The signal can be a very long signal of length (say L) where its length is many times greater than N. The pwelch method starts off by calculating the DFT of the first N samples, then moves ahead to look at the next N samples and so on until all the "frames" have been looked at. So, what you are left with is the DFTs of every frame of sample size N of the signal of length N. Say, N is 256 points and the L is 44100 points.
Therefore, pwelch takes L points (L > N) and spits out N points for each "frame" of length N of a signal of length L.
There are more details involving windowing and whether you want consecutive frames to have some samples that overlap with each other and so on.
I hope this helps as a first pass explanation.
I'm currently doing a fluid simulation. The flow is calculated in discretized steps of 0.0625 s. I think the flow is periodic in all points because it is periodic in some points.
I also calculated the Fourier Transform of this. There was a minor peak at 0.5356 Hz (and some more at higher frequencies). So the period is 1.8671 s. This was consistent with the corresponding signal.
But now I want to prove that this counts for all the nodes of my mesh (around 7000 nodes). Is there a fast way for doing this in MATLAB?
Thanks
(I would have loved to add pictures but I couldn't)
Yes.
If the input X is a matrix, Y = fft(X) returns the Fourier transform of each column of the matrix. This is considerably faster than looping through each column and calling fft(x) one at a time.
You will need to reshape your input data into a 2-D matrix, where the row dimension is time, for the analysis.
Currently, I working on a assignment to obtain few frames from a movie file played in Matlab. A 3D Matrix was created in parameter X,Y and time. But I been asked to determine the frequency in time by using FFT and IFFT.
My problem is how to plot the graph by using FFT and IFFT on 3D matrix to determine the frequency in time dimension? If someone can provide part of the matlab code will very appreciate.
Suppose your matrix is A(x,y,t), call
A = ifft(fft(A, NFFT, 3), size(A,3), 3);
to do the transform on time domain. NFFT is the total points needed, usually padding with the size of 2^n.
In fft(A, NFFT, 3), your frequency axis will be (0:NFFT)/NFFT*Fs, where Fs = 1/T, T is the time interval of your frames.