13x8 Matrix Cubic Interpolation

5 views (last 30 days)
Esat Akdöngel
Esat Akdöngel on 26 Oct 2021
Answered: Image Analyst on 26 Oct 2021
I have a matrix [13x8]. I want to cubic interpolate it to [50x8]. I tried "csapi" but I couldn't manage to figure it out.
[0.0000 0.0000 0.0000 0.0000 0.0000 0.0890 0.2860 0.4380;
0.0177 0.0648 0.0888 0.1070 0.1640 0.3680 0.5720 0.7040;
0.0594 0.1778 0.2445 0.3140 0.4250 0.6140 0.7650 0.8540;
0.2652 0.4723 0.6038 0.7260 0.8250 0.8970 0.9500 0.9820;
0.5436 0.7547 0.8852 0.9570 0.9800 0.9910 0.9980 1.0000;
0.7409 0.9056 0.9870 1.0000 1.0000 1.0000 1.0000 1.0000
0.7710 0.9260 0.9980 1.0000 1.0000 1.0000 1.0000 1.0000
0.7695 0.9260 0.9980 1.0000 1.0000 1.0000 1.0000 1.0000
0.6399 0.8297 0.9401 0.9710 0.9800 0.9850 0.9900 0.9920
0.3369 0.5788 0.7226 0.7780 0.8020 0.8270 0.8510 0.8770
0.0771 0.2463 0.3493 0.3890 0.4070 0.4300 0.4720 0.5360
0.0200 0.1019 0.1577 0.1770 0.1840 0.1940 0.2290 0.2990
0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0200 0.0510];

Accepted Answer

Chris
Chris on 26 Oct 2021
Edited: Chris on 26 Oct 2021
Like this?
V = [0.0000 0.0000 0.0000 0.0000 0.0000 0.0890 0.2860 0.4380;
0.0177 0.0648 0.0888 0.1070 0.1640 0.3680 0.5720 0.7040;
0.0594 0.1778 0.2445 0.3140 0.4250 0.6140 0.7650 0.8540;
0.2652 0.4723 0.6038 0.7260 0.8250 0.8970 0.9500 0.9820;
0.5436 0.7547 0.8852 0.9570 0.9800 0.9910 0.9980 1.0000;
0.7409 0.9056 0.9870 1.0000 1.0000 1.0000 1.0000 1.0000
0.7710 0.9260 0.9980 1.0000 1.0000 1.0000 1.0000 1.0000
0.7695 0.9260 0.9980 1.0000 1.0000 1.0000 1.0000 1.0000
0.6399 0.8297 0.9401 0.9710 0.9800 0.9850 0.9900 0.9920
0.3369 0.5788 0.7226 0.7780 0.8020 0.8270 0.8510 0.8770
0.0771 0.2463 0.3493 0.3890 0.4070 0.4300 0.4720 0.5360
0.0200 0.1019 0.1577 0.1770 0.1840 0.1940 0.2290 0.2990
0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0200 0.0510];
surf(V)
F = griddedInterpolant(V,'cubic');
X = linspace(1,13,50);
Y = 1:8;
[XX,YY] = ndgrid(X,Y);
interpolated = F(XX,YY);
surf(interpolated)
  2 Comments
Chris
Chris on 26 Oct 2021
The values are in the matrix "interpolated."
Or use interp2.

Sign in to comment.

More Answers (2)

Image Analyst
Image Analyst on 26 Oct 2021
You can use imresize() to do bicubic interpolation, if you have the image Processing Toolbox
resizedMatrix = imresize(m, [50,8])

John D'Errico
John D'Errico on 26 Oct 2021
Edited: John D'Errico on 26 Oct 2021
Simplest is to just read the help for interp2. It is silly to use a lower level tool when a high level tool does exactly what you want.

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by