필터 지우기
필터 지우기

Continuous Time Fourier Transform of a signal matrix

조회 수: 9 (최근 30일)
Anubhav Rohatgi
Anubhav Rohatgi 2012년 7월 28일
답변: Juhi Maraskole 2020년 9월 16일
I have a matrix of 100 rows and 2 columns. Column 1 consists of time signal at frequency 50Hz (0.02 0.04 0.06...) column 2 is signal whose fft is to be determined. I would like to have a function that determines the Fourier transform of the signal at the frequency determined by the 1st column of the matrix.

채택된 답변

Wayne King
Wayne King 2012년 7월 28일
편집: Wayne King 2012년 7월 28일
If the first column of your matrix is just the time vector with increments of 0.02 seconds, then just take the Fourier transform of the 2nd column
Let X be your matrix
xdft = fft(X(:,2));
If the signal is real-valued, you only need 1/2 the DFT to examine the amplitude spectrum.
The frequency vector can be formed as follows:
freq = 0:50/100:25;
For example:
t = 0:0.02:(100*0.02)-0.02;
x = cos(2*pi*10*t)+randn(size(t));
X(:,1) = t';
X(:,2) = x';
% Now X is your matrix
xdft = fft(X(:,2));
xdft = xdft(1:length(xdft)/2+1);
freq = 0:50/100:25;
plot(freq,abs(xdft))
xlabel('Hz'); ylabel('Magnitude')
  댓글 수: 1
Anubhav Rohatgi
Anubhav Rohatgi 2012년 7월 28일
Thanks for your response, but I am not getting the results still here is my code:
x = data(:,2);
len = length(x)
t = 0:0.02:(len*0.02)-0.02;
xdft = fft(x);
xdft = xdft(1:length(xdft)/2+1);
freq = 0:50/len:25;
plot(freq,abs(xdft))
xlabel('Hz'); ylabel('Magnitude')
Output is a line of 0 magnitude and on the X axis
and getting a warning:::: Warning: Integer operands are required for colon operator when used as index > In test3 at 9
Datafile can be accessed from :::

댓글을 달려면 로그인하십시오.

추가 답변 (3개)

Wayne King
Wayne King 2012년 7월 28일
편집: Wayne King 2012년 7월 28일
You stated in your original post that your matrix had an even number of elements, 100x2. In fact your matrix is 9079x2. You data also has a mean which is nonzero so that will make the 0 frequency component very large, it's better to remove the mean first.
x = data(:,2);
x = detrend(x,0);
len = length(x)
t = 0:0.02:(len*0.02)-0.02;
xdft = fft(x);
xdft = xdft(1:(length(xdft)+1)/2);
freq = 0:50/len:25;
plot(freq,abs(xdft))
xlabel('Hz'); ylabel('Magnitude')
  댓글 수: 1
Anubhav Rohatgi
Anubhav Rohatgi 2012년 7월 28일
편집: Anubhav Rohatgi 2012년 7월 28일
Thanks alot .. you solved my problem. Thank you very very much...

댓글을 달려면 로그인하십시오.


Anubhav Rohatgi
Anubhav Rohatgi 2012년 8월 28일
Hi Wayne,
I have tried to solve the problem but the plot I get is not what I want. I have breathing data that is very periodic. I have attached the data link to this
https://docs.google.com/open?id=0BzuiGHpNJIxCTXZ1ek9Ob1c5azA
I want to get frequency peaks at around 3Hz.
Please help me.

Juhi Maraskole
Juhi Maraskole 2020년 9월 16일
x(t) = e-AT

카테고리

Help CenterFile Exchange에서 Spectral Measurements에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by