Using interp1 to interpolate y values

조회 수: 4 (최근 30일)
Kelly
Kelly 2019년 3월 3일
댓글: Kelly 2019년 3월 4일
Hi,
I am attempting to interpolate my y values array instead of my x values.
Data: (y : 35x1534 double) (x: 35x1 double) (ny= 35x46 double)
newy = interp1(y,x,ny);
Hoping to have an output which is
newy : 35x46 double
However it returns with dimension errors. Is it possible to interpolate my y values to my ny values or would this not be possible?
Thanks.
  댓글 수: 3
Kelly
Kelly 2019년 3월 3일
I dont know if it is possible but I am trying make y the same dimensions as ny and I thought I could perhaps do this via interp1. I have attached the data.
Cris LaPierre
Cris LaPierre 2019년 3월 4일
편집: Cris LaPierre 2019년 3월 4일
I don't think interpolating is going to work for you. Interpolation requires your data cover the same range of values just sampled at different intervals. Besides both having 35 rows, I don't see any sort of overlap in your data.
Here's your Y data (35x1534)
Here's your NY data (35x46)

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

채택된 답변

Cris LaPierre
Cris LaPierre 2019년 3월 4일
편집: Cris LaPierre 2019년 3월 4일
Since interpolating your data doesn't make sense to me, I suggest trying to downsample y instead.
idx46 = round(linspace(1,1534,46));
newy = y(:,idx46)
  댓글 수: 1
Kelly
Kelly 2019년 3월 4일
Yes this has worked, thank you so much!

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

추가 답변 (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