how to decimate signal with fs 44100 into fs10k

조회 수: 4 (최근 30일)
Syed Ali Faraz Jaffery
Syed Ali Faraz Jaffery 2022년 6월 3일
편집: dpb 2022년 6월 4일
hello everyone
how can i decimate a signal which fs is 44100 and i want the the fs is 10000???
i am getting the error (Resampling rate R must be a positive integer.)
clear all
close all
clc
fs=44100;
t=0:1/fs:5-1/fs;
f=200;
x=10*sin(2*pi*f*t);
d_x=decimate(x,4.41);
figure
subplot(211);
plot(t,x);
title("Orignal Signal,");
subplot(212);
plot(d_x);
title("Decimated Signal");

답변 (1개)

dpb
dpb 2022년 6월 3일
편집: dpb 2022년 6월 4일
decimate does what the name says -- sets a factor of n fewer samples.
You're looking for resample instead
d_x=resample(x,10.0,44.1);
  댓글 수: 3
dpb
dpb 2022년 6월 3일
That's because I cut 'n pasted and then didn't change your function name. As says in text, use resample instead of decimate. "Do what I mean, not what I say..." :)
Syed Ali Faraz Jaffery
Syed Ali Faraz Jaffery 2022년 6월 4일
편집: Syed Ali Faraz Jaffery 2022년 6월 4일
The resample change the frequencies of the loaded audio signal.
But finnaly i write the code to achieve 10k fs
clear all
close all
clc
fs=44100;
t=0:1/fs:1-1/fs;
f=1;
x=10*sin(2*pi*f*t);
c_x=decimate(x,441);
d_x=interp(c_x,100);
figure
subplot(211);
stem(x);
title("Orignal Signal,");
subplot(212);
stem(d_x);
title("Decimated Signal");

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

카테고리

Help CenterFile Exchange에서 Multirate Signal Processing에 대해 자세히 알아보기

태그

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by