필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

How can I interpolate

조회 수: 1 (최근 30일)
Gustavo Caldeira
Gustavo Caldeira 2017년 7월 13일
마감: MATLAB Answer Bot 2021년 8월 20일
Hi everybody I'm trying to create some tools to help analyze my measurements and I need some help. Here's my problem: Sometimes I measure some variables with different frequencies for instance, 2 and 5Hz, and now I want to interpolate the variable with the least row numbers in order to make this variable with the same row numbers as the variable with the most row numbers. I want this tool to automatically "recognize" which variables have less number, interpolate them and finally assign them to original variable with the interpolated values. Any suggestions? Thanks!

답변 (1개)

dbmn
dbmn 2017년 7월 14일
Try to include some of the following functions in your code
numel(x)
% This allows you to "count" the number of elements in your variable
numel(x(:,1)); numel(x(1,:))
% use that if you just want to count the number of element in a row or column vector of your data
And for the interpolation part use
x_new_short = x_long;
y_new_short = interp1(x_short, y_short, x_new_short);
So basically what you want to do is
  1. Figure out which Element is longer/shorter using numel
  2. Interpolate the shorter element to the long size using interp1
Try to write your own code and post it here, if you are still having trouble...

이 질문은 마감되었습니다.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by