resampling signals in matlab 2012b

hello i want to downsampling a signal with 173HZ and 23.6s to 120HZ ,can i do it with matlab 2012b ?

 採用された回答

m
m 2013 年 8 月 16 日

0 投票

yes, i have signalprocessing toolbox,but i cant use '_resample()_' can you tell me about parameters (173 hz to 120 hz)? thanks.

17 件のコメント

Jan
Jan 2013 年 8 月 16 日
編集済み: Jan 2013 年 8 月 16 日
Matlab help says:
y = resample(x,p,q) resamples the sequence in vector x at p/q times the original sampling rate, using a polyphase filter implementation. p and q must be positive integers. The length of y is equal to ceil(length(x)*p/q). If x is a matrix, resample works down the columns of x.
i.e. in your case p=120 and q=173, so:
x_resampled = resample( x, 120, 172 )
should do the trick.
m
m 2013 年 8 月 16 日
thanks for your answer,i run it but get this error: "_Too many input arguments._" do you know this error? my x variable is eq 4096
Jan
Jan 2013 年 8 月 16 日
Check the type of your signal. It should be either a vector or a 2-d matrix.
m
m 2013 年 8 月 16 日
編集済み: m 2013 年 8 月 16 日
can i attach the file of sampled signal to this comment, that you can see it?
Jan
Jan 2013 年 8 月 16 日
Before you start uploading files: how do you load the signal into the Matlab environment and what kind of signal is it that you are dealing with?
m
m 2013 年 8 月 16 日
i want to import the eeg signal ,the file has 4097 numbers,i use import from menu then import it to a variable,and the file has one column... i think matlab has a bug with this function because when i try to run sample code of 'resample' i see this error again !
Jan
Jan 2013 年 8 月 16 日
In the Matlab command line type whos and post the output.
Also type the variable name and post that output, too.
m
m 2013 年 8 月 16 日
my input command : y=resample(inputsig,120,173); output : Error using resample Too many input arguments.
my enviroment report : Name Size Bytes Class Attributes
inputsig 4097x1 32776 double
y 1x4098 32784 double
Jan
Jan 2013 年 8 月 16 日
Could you type
which resample
and post that output?
Walter Roberson
Walter Roberson 2013 年 8 月 16 日
Please post the result of
which -all resample
m
m 2013 年 8 月 16 日
ofcourse, the output is :E:\edu\ARSHAD AI\classes\EVALUATIONARY ALGORITHMS\Project\Steps\Data\resample.m
do you think the path is so long?
Jan
Jan 2013 年 8 月 16 日
No, there is a function in your project that is called resample too which hides Matlab's resample function. Unload the path you just posted from your environment and try to call resample again.
m
m 2013 年 8 月 16 日
編集済み: m 2013 年 8 月 16 日
E:\edu\ARSHAD AI\classes\EVALUATIONARY ALGORITHMS\Project\Steps\Data\resample.m C:\Program Files\MATLAB\R2012b\toolbox\matlab\timeseries\@timeseries\resample.m C:\Program Files\MATLAB\R2012b\toolbox\ident\ident\@iddata\resample.m C:\Program Files\MATLAB\R2012b\toolbox\simbio\simbio\@SimData\resample.m C:\Program Files\MATLAB\R2012b\toolbox\matlab\timeseries\@tscollection\resample.m C:\Program Files\MATLAB\R2012b\toolbox\signal\signal\resample.m
m
m 2013 年 8 月 16 日
after i delete my resample function : C:\Program Files\MATLAB\R2012b\toolbox\signal\signal\resample.m
m
m 2013 年 8 月 16 日
OK OK ,after delete my resample function it works well... thanks so much
Jan
Jan 2013 年 8 月 16 日
No problem... but next time check which answer you chose as 'accepted answer' (:
m
m 2013 年 8 月 16 日
yes,sorry..

サインインしてコメントする。

その他の回答 (1 件)

Jan
Jan 2013 年 8 月 16 日

0 投票

If you have the Signalprocessing Toolbox use resample() or decimate()
If not, look at interp1()

製品

質問済み:

m
m
2013 年 8 月 16 日

Community Treasure Hunt

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

Start Hunting!

Translated by