Interp1 Error using interp1>re​shapeAndSo​rtXandV

조회 수: 9 (최근 30일)
CaptGamma
CaptGamma 2020년 10월 23일
답변: Star Strider 2020년 10월 23일
Hi,
I am trying to resample a step response using interpolation but I keep running into this error.
Error using interp1>reshapeAndSortXandV (line 424)
X and V must be of the same length.
Error in interp1 (line 93)
[X,V,orig_size_v] = reshapeAndSortXandV(varargin{1},varargin{2});
Error in Project1 (line 14)
s1 = interp1(t,s,t1);
I am using the following code and have attached the file.
% Load/Play/Plot Audio sample
[y,fs]= audioread('sample_hum.wav');
sound(y,fs);
y = y(:,1);
dt= 1/fs;
t= 0:dt:(length(y)*dt)-dt;
figure(1);
plot(t,y); xlabel('Seconds'); ylabel('Amplitude');
% Load and Plot Step Response
figure(2);
plot(filterresponse{:,1}); xlabel('Time'); ylabel('Vo');
%Resample the step response
t1 = 0:1/fs:t(end);
s1 = interp1(t,s,t1);
figure(3);
plot(s,t);
hold on
plot(s1,t1);
hold off

채택된 답변

Star Strider
Star Strider 2020년 10월 23일
I have absolutely no idea what you’re doing.
For signal processing applications, use the resample function.

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by