20 views (last 30 days)

Hi,

i have a data set like shown in figure1,

I try to create a new interpolate data between each sequential two data points with interp1 (one point for each sequential two data points) and the result are given in figure 2. Although i have 100 data the interpolated data are 57. It have to be 99.

It is obviously shown from figure 2 that it did not calculate interpolate data for sequential two data points. Especially sides do not have any interpolated data. What will be the solution

Thank you..

Vxi = min(Vx):0.1:max(Vx);

Vyi = interp1(Vx,Vy,Vxi, 'nearest');

plot(Vxi,Vyi, 'o')

FIGURE 1

FIGURE 2

Roshni Garnayak
on 5 Aug 2019

The interp1 function performs 1D interpolation and computes one y-value for the corresponding x-value. Due to this only one point is computed in the x : x+0.1 range even when a number of data points are clustered in that range.

A possible solution is to use variable interval size for Vxi. The intervals where more data points are located can be assigned smaller interval size and the intervals with lesser number of points can be allotted larger interval size.

Sign in to comment.

Sign in to answer this question.

Opportunities for recent engineering grads.

Apply Today
## 7 Comments

## Direct link to this comment

https://ch.mathworks.com/matlabcentral/answers/472922-about-interp1-function#comment_727226

⋮## Direct link to this comment

https://ch.mathworks.com/matlabcentral/answers/472922-about-interp1-function#comment_727226

## Direct link to this comment

https://ch.mathworks.com/matlabcentral/answers/472922-about-interp1-function#comment_727538

⋮## Direct link to this comment

https://ch.mathworks.com/matlabcentral/answers/472922-about-interp1-function#comment_727538

## Direct link to this comment

https://ch.mathworks.com/matlabcentral/answers/472922-about-interp1-function#comment_727635

⋮## Direct link to this comment

https://ch.mathworks.com/matlabcentral/answers/472922-about-interp1-function#comment_727635

## Direct link to this comment

https://ch.mathworks.com/matlabcentral/answers/472922-about-interp1-function#comment_727697

⋮## Direct link to this comment

https://ch.mathworks.com/matlabcentral/answers/472922-about-interp1-function#comment_727697

## Direct link to this comment

https://ch.mathworks.com/matlabcentral/answers/472922-about-interp1-function#comment_727723

⋮## Direct link to this comment

https://ch.mathworks.com/matlabcentral/answers/472922-about-interp1-function#comment_727723

## Direct link to this comment

https://ch.mathworks.com/matlabcentral/answers/472922-about-interp1-function#comment_727907

⋮## Direct link to this comment

https://ch.mathworks.com/matlabcentral/answers/472922-about-interp1-function#comment_727907

## Direct link to this comment

https://ch.mathworks.com/matlabcentral/answers/472922-about-interp1-function#comment_728018

⋮## Direct link to this comment

https://ch.mathworks.com/matlabcentral/answers/472922-about-interp1-function#comment_728018

Sign in to comment.