How do I downsample a signal using Octave?
up vote
1
down vote
favorite
I have been trying to downsample a signal, but I'm not sure if I have the proper command? can you give me the proper command with a brief explanation?
matlab octave
New contributor
add a comment |
up vote
1
down vote
favorite
I have been trying to downsample a signal, but I'm not sure if I have the proper command? can you give me the proper command with a brief explanation?
matlab octave
New contributor
1
Try theresample
function from thesignal
package: octave.sourceforge.io/signal/function/resample.html
– am304
Nov 19 at 13:03
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I have been trying to downsample a signal, but I'm not sure if I have the proper command? can you give me the proper command with a brief explanation?
matlab octave
New contributor
I have been trying to downsample a signal, but I'm not sure if I have the proper command? can you give me the proper command with a brief explanation?
matlab octave
matlab octave
New contributor
New contributor
New contributor
asked Nov 19 at 12:48
Mary ProgrammerWant2Be
85
85
New contributor
New contributor
1
Try theresample
function from thesignal
package: octave.sourceforge.io/signal/function/resample.html
– am304
Nov 19 at 13:03
add a comment |
1
Try theresample
function from thesignal
package: octave.sourceforge.io/signal/function/resample.html
– am304
Nov 19 at 13:03
1
1
Try the
resample
function from the signal
package: octave.sourceforge.io/signal/function/resample.html– am304
Nov 19 at 13:03
Try the
resample
function from the signal
package: octave.sourceforge.io/signal/function/resample.html– am304
Nov 19 at 13:03
add a comment |
2 Answers
2
active
oldest
votes
up vote
2
down vote
accepted
Depending on what you are trying to achieve, the downsample
can be enough.
Example code:
pkg load signal % To download the signal package
x = cos(1:1000); % Create a signal
y = downsample(x, 2);
However, it will not apply a low-pass filter so it can introduce unwanted aliasing effects on your signal. Like the command help downsample
says:
For most signals you will want to use
decimate
instead since it prefilters the high frequency components of the signal and avoids aliasing effects.
Now if you want to downsample and apply the low-pass filter, you would like to use decimate
but it only works for a downsampling with an integer factor, for example from 96kHz to 48kHz, you decimate by a factor 2. From help decimate
Note that Q must be an integer for this rate change method.
Example code:
pkg load signal % To download the signal package
x = cos(1:1000); % Create a signal
y = decimate(x, 2);
Finally, if you want to downsample by a rational number, for example by a factor of 2/3, from 96kHz to 64kHz, you will need resample
like it was suggested by other users.
pkg load signal % To download the signal package
x = cos(1:1000); % Create a signal
y = resample(x, 2, 3);
Note that you can still use resample
to downsample by an integer factor, for example y = resample(x, 1, 2);
but it slower that decimate
.
add a comment |
up vote
0
down vote
e.g.
y=resample(x,L,M);
.
.
x--> your signal
L--> increase sampling rate
M--> reduce sampling rate
New contributor
do I have to declare L and M or is it just apart of the code?
– Mary ProgrammerWant2Be
Nov 19 at 16:12
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
accepted
Depending on what you are trying to achieve, the downsample
can be enough.
Example code:
pkg load signal % To download the signal package
x = cos(1:1000); % Create a signal
y = downsample(x, 2);
However, it will not apply a low-pass filter so it can introduce unwanted aliasing effects on your signal. Like the command help downsample
says:
For most signals you will want to use
decimate
instead since it prefilters the high frequency components of the signal and avoids aliasing effects.
Now if you want to downsample and apply the low-pass filter, you would like to use decimate
but it only works for a downsampling with an integer factor, for example from 96kHz to 48kHz, you decimate by a factor 2. From help decimate
Note that Q must be an integer for this rate change method.
Example code:
pkg load signal % To download the signal package
x = cos(1:1000); % Create a signal
y = decimate(x, 2);
Finally, if you want to downsample by a rational number, for example by a factor of 2/3, from 96kHz to 64kHz, you will need resample
like it was suggested by other users.
pkg load signal % To download the signal package
x = cos(1:1000); % Create a signal
y = resample(x, 2, 3);
Note that you can still use resample
to downsample by an integer factor, for example y = resample(x, 1, 2);
but it slower that decimate
.
add a comment |
up vote
2
down vote
accepted
Depending on what you are trying to achieve, the downsample
can be enough.
Example code:
pkg load signal % To download the signal package
x = cos(1:1000); % Create a signal
y = downsample(x, 2);
However, it will not apply a low-pass filter so it can introduce unwanted aliasing effects on your signal. Like the command help downsample
says:
For most signals you will want to use
decimate
instead since it prefilters the high frequency components of the signal and avoids aliasing effects.
Now if you want to downsample and apply the low-pass filter, you would like to use decimate
but it only works for a downsampling with an integer factor, for example from 96kHz to 48kHz, you decimate by a factor 2. From help decimate
Note that Q must be an integer for this rate change method.
Example code:
pkg load signal % To download the signal package
x = cos(1:1000); % Create a signal
y = decimate(x, 2);
Finally, if you want to downsample by a rational number, for example by a factor of 2/3, from 96kHz to 64kHz, you will need resample
like it was suggested by other users.
pkg load signal % To download the signal package
x = cos(1:1000); % Create a signal
y = resample(x, 2, 3);
Note that you can still use resample
to downsample by an integer factor, for example y = resample(x, 1, 2);
but it slower that decimate
.
add a comment |
up vote
2
down vote
accepted
up vote
2
down vote
accepted
Depending on what you are trying to achieve, the downsample
can be enough.
Example code:
pkg load signal % To download the signal package
x = cos(1:1000); % Create a signal
y = downsample(x, 2);
However, it will not apply a low-pass filter so it can introduce unwanted aliasing effects on your signal. Like the command help downsample
says:
For most signals you will want to use
decimate
instead since it prefilters the high frequency components of the signal and avoids aliasing effects.
Now if you want to downsample and apply the low-pass filter, you would like to use decimate
but it only works for a downsampling with an integer factor, for example from 96kHz to 48kHz, you decimate by a factor 2. From help decimate
Note that Q must be an integer for this rate change method.
Example code:
pkg load signal % To download the signal package
x = cos(1:1000); % Create a signal
y = decimate(x, 2);
Finally, if you want to downsample by a rational number, for example by a factor of 2/3, from 96kHz to 64kHz, you will need resample
like it was suggested by other users.
pkg load signal % To download the signal package
x = cos(1:1000); % Create a signal
y = resample(x, 2, 3);
Note that you can still use resample
to downsample by an integer factor, for example y = resample(x, 1, 2);
but it slower that decimate
.
Depending on what you are trying to achieve, the downsample
can be enough.
Example code:
pkg load signal % To download the signal package
x = cos(1:1000); % Create a signal
y = downsample(x, 2);
However, it will not apply a low-pass filter so it can introduce unwanted aliasing effects on your signal. Like the command help downsample
says:
For most signals you will want to use
decimate
instead since it prefilters the high frequency components of the signal and avoids aliasing effects.
Now if you want to downsample and apply the low-pass filter, you would like to use decimate
but it only works for a downsampling with an integer factor, for example from 96kHz to 48kHz, you decimate by a factor 2. From help decimate
Note that Q must be an integer for this rate change method.
Example code:
pkg load signal % To download the signal package
x = cos(1:1000); % Create a signal
y = decimate(x, 2);
Finally, if you want to downsample by a rational number, for example by a factor of 2/3, from 96kHz to 64kHz, you will need resample
like it was suggested by other users.
pkg load signal % To download the signal package
x = cos(1:1000); % Create a signal
y = resample(x, 2, 3);
Note that you can still use resample
to downsample by an integer factor, for example y = resample(x, 1, 2);
but it slower that decimate
.
edited Nov 21 at 15:31
answered Nov 21 at 13:23
Bebs
6412923
6412923
add a comment |
add a comment |
up vote
0
down vote
e.g.
y=resample(x,L,M);
.
.
x--> your signal
L--> increase sampling rate
M--> reduce sampling rate
New contributor
do I have to declare L and M or is it just apart of the code?
– Mary ProgrammerWant2Be
Nov 19 at 16:12
add a comment |
up vote
0
down vote
e.g.
y=resample(x,L,M);
.
.
x--> your signal
L--> increase sampling rate
M--> reduce sampling rate
New contributor
do I have to declare L and M or is it just apart of the code?
– Mary ProgrammerWant2Be
Nov 19 at 16:12
add a comment |
up vote
0
down vote
up vote
0
down vote
e.g.
y=resample(x,L,M);
.
.
x--> your signal
L--> increase sampling rate
M--> reduce sampling rate
New contributor
e.g.
y=resample(x,L,M);
.
.
x--> your signal
L--> increase sampling rate
M--> reduce sampling rate
New contributor
New contributor
answered Nov 19 at 15:59
Nima
1
1
New contributor
New contributor
do I have to declare L and M or is it just apart of the code?
– Mary ProgrammerWant2Be
Nov 19 at 16:12
add a comment |
do I have to declare L and M or is it just apart of the code?
– Mary ProgrammerWant2Be
Nov 19 at 16:12
do I have to declare L and M or is it just apart of the code?
– Mary ProgrammerWant2Be
Nov 19 at 16:12
do I have to declare L and M or is it just apart of the code?
– Mary ProgrammerWant2Be
Nov 19 at 16:12
add a comment |
Mary ProgrammerWant2Be is a new contributor. Be nice, and check out our Code of Conduct.
Mary ProgrammerWant2Be is a new contributor. Be nice, and check out our Code of Conduct.
Mary ProgrammerWant2Be is a new contributor. Be nice, and check out our Code of Conduct.
Mary ProgrammerWant2Be is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53375003%2fhow-do-i-downsample-a-signal-using-octave%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Try the
resample
function from thesignal
package: octave.sourceforge.io/signal/function/resample.html– am304
Nov 19 at 13:03