non square matrix interpolation matlab (colorgraph)
Show older comments
I need help to interpolate non-square matrices in my code, because the code I have been working on works only for square matrices.
Thank you
clc; clear; close all;
V = [600.1 645.23 865.17 1425.8 1254.4;
1012.1 1055.8 1006.3 1537.1 1212;
1296.6 1616.6 1351.9 1393.5 1391.9;
639.5 868.24 890.56 1644.9 1770.8;
639.5 868.24 890.56 1644.9 1770.8];
ecol = 30;
ncol = 5 ;
efil = 30;
nfil = 5 ;
%% Matriz de valores para la interpolación del paño
x = (0:ecol:(ncol-1)*ecol);
for i = 1:ncol
X(i,:)= x;
end
y = (0:efil:(nfil-1)*efil)';
for k = 1:nfil
Y(:,k)= y;
end
x = (0:1:(ncol-1)*ecol);
for i = 1:(nfil-1)*efil + 1
Xq(i,:)= x;
end
y = (0:1:(nfil-1)*efil)';
for k = 1:(ncol-1)*ecol + 1
Yq(:,k)= y;
end
M1q = interp2(X,Y,V,Xq,Yq,'cubic');
%% Ploteo del mapa de velocidades
figure('units','normalized','outerposition',[0 0 1 1])
s = contourf(Xq,Yq,M1q,'--','showtext', 'on');
view(2)
colorbar
set(gca,'Ydir','reverse');
axis tight
title("ST1 [m/s]", 'Fontsize', 15, 'Fontname', 'Times New Roman')
xlabel("Horizontal Displacement [cm]", 'Fontsize', 15, 'Fontname', 'Times New Roman')
ylabel("Vertical Displacement [cm]", 'Fontsize', 15, 'Fontname', 'Times New Roman')
1 Comment
Carlos
on 8 Jun 2022
interesting question..
Accepted Answer
More Answers (0)
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!