How do I convert a time domain signal to frequency domain?

I am having some problems converting a time domain signal into frequency domain--I don't have constant sampling time.
In time domain, is this the way to plot the graph?
value = [42007935 111212895 184546560 238219725 238219725 184546560 111212895 42007935]; time = [0, ,5,1.25,2, 2,5,5, 4, 4.5, 6, 7, 8 ];
plot (time, value);
X and/or Y arguments ignored.
Could anyone help me plot a signal that does not have constant time?

댓글 수: 2

If you want to plot them, your time and value arrays have to have the same number of elements. They don’t.
dpb
dpb 2014년 5월 12일
편집: dpb 2014년 5월 12일
Look for NUFFT (non-uniform FFT) literature -- there's quite a lot.
You surely have the sample times or at least delta-t's, don't you? W/o that you have nothing.
Don't believe TMW has an implementation packaged as yet, anyway.
ADDENDUM:
You might check the File Exchange for submissions and of course there's always a search including Matlab in the search.

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

답변 (2개)

Vilnis Liepins
Vilnis Liepins 2014년 5월 13일

0 개 추천

Hello,
To convert nonuniform time domain data to frequency domain you can use Extended DFT (program NEDFT.m) available on fileexchange http://www.mathworks.com/matlabcentral/fileexchange/11020-extended-dft
NEDFT call line:
F=nedft(value,time,fn);
where frequencies [fn] could be generated as
fn=[-ceil((N-1)/2):floor((N-1)/2)]/N/T;
As I see from your example [time] data the mean sampling frequency T=1. The length of DFT N usually is set equal to or greater than the length(value) that, as Star Strider commented, should have the same dimensions as [time] array.
After that you also be able to get back constant time version of your data [value1] by applying IFFT to the result of NEDFT, call line:
value1=real(ifft(fftshift(F)));

댓글 수: 1

Hello,
Thank you very much for your answer. May i know in that program where should i specify time and value parameter

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

Vilnis Liepins
Vilnis Liepins 2014년 5월 19일
편집: Vilnis Liepins 2014년 5월 19일

0 개 추천

Actually they are specified in your post:
>> value = [42007935 111212895 184546560 238219725 238219725 184546560 111212895 42007935];
>> time = [0, ,5,1.25,2, 2,5,5, 4, 4.5, 6, 7, 8 ];
Note that you need to correct the 'time' vector: time(1)<time(2)<time(3)<... and length(value) must be equal to length(time):
- the signal value(1)=42007935 is taken at time(1),
- the signal value(2)=111212895 is taken at time(2), and so on.

댓글 수: 8

Hello Vilnis Liepins, Thank you very much for your solution.. In your Nedft.m which you have programmed where exactly i should specify the parameters values of 1.Value 2.time
Thanks in advance!!!
Hello again! Input parameters for nedft.m should be specified or calculated outside the function. Example code:
value = [42007935 111212895 184546560 238219725 238219725 184546560 111212895 42007935];
time = [0.5 1.25 2 2.55 4 4.5 6 7];
N=length(value); T=1;
fn=[-ceil((N-1)/2):floor((N-1)/2)]/N/T;
F=nedft(value,time,fn);
value1=round(real(ifft(fftshift(F))));
time1=0:N-1;
plot(time,value,'-g',time1,value1,'-b');
Hello When i run your i get the following error Cannot find an exact (case-sensitive) match for 'nedft.m'
The closest match is C:\Users\yogesh\Desktop\NEDFT.M
To change the file extension, cd to the file's folder, type: movefile NEDFT.M NEDFT.m_bad; movefile NEDFT.m_bad NEDFT.m and then cd back.
Let me know how to solve this situation
Vilnis Liepins
Vilnis Liepins 2014년 5월 19일
편집: Vilnis Liepins 2014년 5월 19일
Nedft.m is just am example script saved as text file and it was created on old Matlab version. I don't have Matlab installed anymore, but I recommend to do something like that: (1) create a new *.m file, (2) copy all the text from nedft.m and paste it into this new matlab file, (3) then save it as nedft.m in your Matlab workspace.
Hello, I have followed your intructions but there is still error after doing that. I PASTEDn from old NEDFT file and created new nedft file but there i am getting following error
Error using nedft (line 97) Incorrect size of input argument fn. See Help nedft.
Hello, Try to execute example code posted by me on 19 May 2014 at 11:15. Copy/paste all lines in Matlab window. In result you should get two plots in one window: nonuniform 'value' and uniform 'value1' get from the nedft.m output. Is it works?
Hello Vilnis Liepins, I AM UNABLE TO FIND your updates which is on 19 May 2014 at 11:15.Could you please guide where it is exactly
It's about four or five comments past...you only need to use the
"Show N older comments"
button to see the previous that have been collapsed by the viewer by default.

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

카테고리

질문:

2014년 5월 12일

댓글:

dpb
2014년 5월 28일

Community Treasure Hunt

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

Start Hunting!

Translated by