# how can we calculate interpolation between two double MATLAB arrays?

33 views (last 30 days)
Guido Pastore on 15 Mar 2019
Commented: Star Strider on 15 Mar 2019
Given two arrays of double of different sizes (A = 1054x1 and B = 601x1) how is it possible to perform an interpolation ??
##### 0 CommentsShowHide -1 older comments

Sign in to comment.

### Accepted Answer

Star Strider on 15 Mar 2019
It depends on how you want to interpolate them. The‘safest’ way is likely to interpolate the longer vector to the length of the shorter vector:
A = sin((0:1053)/105)';
B = cos((0:600)/30)';
Ai = interp1((1:numel(A))', A, (1:numel(B)), 'linear', 'extrap');
You can then see the result (a sort of Lissajous figure):
figure
plot(Ai, B)
grid
##### 8 CommentsShowHide 7 older comments
Star Strider on 15 Mar 2019
As always, my pleasure.

Sign in to comment.

### Categories

Find more on Interpolation in Help Center and File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by