How to change sampling points and frequency of a matrix?
1 次查看(过去 30 天)
显示 更早的评论
I have a m x n grid X and another m x n matrix v with values corresponding to each grid point of X . I want:
1) resample X to make it m x m without changing the boundary values (i.e. max and min)
2) the interp v according to the new grid so that it is also m x m
0 个评论
采纳的回答
Ameer Hamza
2020-6-14
Try something like this
m = 10;
n = 15;
x_range = [0 1];
y_range = [3 6];
[X, Y] = meshgrid(linspace(x_range(1), x_range(2), n), linspace(y_range(1), y_range(2), m));
Z = rand(size(X));
[X_new, Y_new] = meshgrid(linspace(x_range(1), x_range(2), m), linspace(y_range(1), y_range(2), m));
Z_new = interp2(X, Y, Z, X_new, Y_new);
X, Y, and Z old grid points having dimensions of m*n. X_new, Y_new, and Z_new and new grids of dimension m*m.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Descriptive Statistics 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!