Reputation: 21
I am trying to convert a MATLAB script into an Octave file. I am using Octave 4.0.
In the MATLAB script, I encountered a line with the format resample(X, tx, fx). Is there any equivalent function in Octave for this resample function?
I am not looking for the function resample(X, p, q).
As per the Mathworks website: y = resample(x,p,q) resamples the input sequence, x, at p/q times the original sample rate. y = resample(x,tx,fs) uses a polyphase antialiasing filter to resample the signal at the uniform sample rate specified in fs.
Upvotes: 2
Views: 5535
Reputation: 12176
For those who need the non-uniform to uniform resampling that Matlab's resample()
provides but Octave's resample()
does not, you can use interp1()
instead.
y = resample(X, tx, fs)
can be converted as
samplecount = (max(tx) - min(tx)) * fs
y = interp1(tx, X, linspace(min(tx), max(tx), samplecount))
Upvotes: 1
Reputation: 1277
Please type in Octave:
>> help resample
Answer will be (in my computer I have installed this package before):
error: help: the 'resample' function belongs to the signal package from Octave Forge which you have installed but not loaded. To load the package, run `pkg load signal' from the Octave prompt.
You must install and load signal package. See instructions in file README.html in root Octave directory (example from Windows distributive):
- Run the script build_packages.m to build and install the packages. Installation is a one-time procedure. After installation packages must still be loaded in order to use them with the pkg load PACKAGENAME command.
Upvotes: 0
Reputation: 738
In the documentation here it says there is one. You should be able to use it like below like in documentation.
[y, h] = resample (x, p, q)
Upvotes: 0