# Interpolate rows of an image/matrix

3 views (last 30 days)
pankaj singh on 13 Oct 2022
Answered: Star Strider on 13 Oct 2022
I have an image (or say a matrix) of 256 x 256. I have the values of every even numbered row (N) of the matrix (say I know the pilots). I want to estimate (or interpolate) the rest of the rows using the already known rows. How can I do it?

Star Strider on 13 Oct 2022
Guessing —
EvenRows = randn(5, 10);
Matrix = NaN(10);
Matrix(2:2:end,:) = EvenRows
Matrix = 10×10
NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN -0.1694 -0.5454 -1.2079 -1.2929 0.6558 0.3970 2.1765 -0.5971 0.4533 -1.4736 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN 1.3471 -0.1326 -0.3580 -0.1716 -1.9907 -0.9430 0.2915 -1.8506 -0.9750 -1.0266 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN -0.4619 -0.4424 -0.5535 -0.6490 -0.7515 -1.6619 -0.4395 -0.3559 1.4254 -1.3562 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN 1.0513 0.1012 0.9823 -0.8944 0.6277 -0.6259 -0.2010 0.7861 0.2967 -2.1416 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN 0.1565 0.2368 -1.1906 -0.6612 1.2323 0.4043 -0.0117 1.7776 -0.0290 0.6236
MatrixInterp = fillmissing(Matrix,'linear')
MatrixInterp = 10×10
-0.9276 -0.7518 -1.6329 -1.8535 1.9790 1.0670 3.1190 0.0297 1.1675 -1.6971 -0.1694 -0.5454 -1.2079 -1.2929 0.6558 0.3970 2.1765 -0.5971 0.4533 -1.4736 0.5889 -0.3390 -0.7830 -0.7323 -0.6674 -0.2730 1.2340 -1.2238 -0.2608 -1.2501 1.3471 -0.1326 -0.3580 -0.1716 -1.9907 -0.9430 0.2915 -1.8506 -0.9750 -1.0266 0.4426 -0.2875 -0.4557 -0.4103 -1.3711 -1.3025 -0.0740 -1.1033 0.2252 -1.1914 -0.4619 -0.4424 -0.5535 -0.6490 -0.7515 -1.6619 -0.4395 -0.3559 1.4254 -1.3562 0.2947 -0.1706 0.2144 -0.7717 -0.0619 -1.1439 -0.3202 0.2151 0.8610 -1.7489 1.0513 0.1012 0.9823 -0.8944 0.6277 -0.6259 -0.2010 0.7861 0.2967 -2.1416 0.6039 0.1690 -0.1041 -0.7778 0.9300 -0.1108 -0.1064 1.2819 0.1338 -0.7590 0.1565 0.2368 -1.1906 -0.6612 1.2323 0.4043 -0.0117 1.7776 -0.0290 0.6236
figure
surf(Matrix)
grid on
title('Original')
figure
surf(MatrixInterp)
title('Linear Interpolation')
grid on
.

### Categories

Find more on Resizing and Reshaping Matrices in Help Center and File Exchange

R2022b

### Community Treasure Hunt

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

Start Hunting!