**Info**

This question is closed. Reopen it to edit or answer.

# How to get 1807 point data array to 1806 data array?

1 view (last 30 days)

Show older comments

I thought the process would go with interpolation like the following but not

u = interp1(u, size(u) - 1);

which gives me `NaN [integer]`, so wrong.

I do not want to lose the accuracy of the results but I need to compare the vector with its original vector which has one point less.

MATLAB: 2016b

##### 0 Comments

### Answers (2)

Guillaume
on 24 Oct 2016

As Marc says, you need a vector for the query points but his solution for generated that vector does not make much sense.

A good way of generating one less query point than the original is to use linspace:

uq = interp1(u, linspace(1, numel(u), numel(u)-1))

That's assuming that the original u correspond to x = 1:numel(u).

##### 3 Comments

Guillaume
on 25 Oct 2016

Marc Jakobi
on 24 Oct 2016

Edited: Marc Jakobi
on 24 Oct 2016

The second input must be a vector, not the size of the output. So if you want to interpolate between the points, use something like

uq = interp1(u, (1.5:length(u) - 0.5)); %assuming u is a vector

##### 2 Comments

Marc Jakobi
on 24 Oct 2016

woops, wasn't paying proper attention there.

it should be

1.5:length(u)-0.5

(assuming u is a vector) Thanks for pointing it out.

### See Also

### Products

### Community Treasure Hunt

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

Start Hunting!