How to interpolation between matrices
5 次查看(过去 30 天)
显示 更早的评论
Imagine the plot attached below. Each point on this plot represents a a 4x4 matrix that describes the behavior of the plant at that particular point. For a controller design, I have a reference load which I need to track at a given speed (omega).
How do I interpolate to get the specific 4-D matrix at a load point and speed which is not already a point on the plot?
Thanks!
0 个评论
采纳的回答
Stephen23
2022-7-29
Assuming that you want to interpolate between the corresponding elements of those 4x4 matrices, then you could do something like this:
C = {randi(9,4,4), randi(9,4,4), randi(9,4,4)}; % 4x4 matrices in a cell array
C{:}
L = [1;3;2]; % load
W = [7;8;9]; % omega
M = cat(3,C{:});
[X,Y] = meshgrid(1:numel(C),1:16);
F = scatteredInterpolant(Y(:),L(X(:)),W(X(:)),M(:),'linear','linear');
Interpolate the entire matrix:
Lq = 1.5;
Wq = 7.5;
out = reshape(F({1:16,Lq,Wq}),4,4)
Lq = 2;
Wq = 8;
out = reshape(F({1:16,Lq,Wq}),4,4)
2 个评论
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!