matlab 稀疏矩阵插值为题
答案:1 悬赏:10 手机版
解决时间 2021-03-18 12:09
- 提问者网友:世勋超人
- 2021-03-17 13:19
matlab 稀疏矩阵插值为题
最佳答案
- 五星知识达人网友:一把行者刀
- 2021-03-17 13:33
A = [23, 0, 0, 0, 22, 0, 0, 0, 0, 29; ...
0, 0, 0, 0, 0, 0, 0, 0, 0, 0; ...
0, 0, 25, 0, 0, 0, 0, 0, 0, 0; ...
0, 0, 0, 0, 0, 25, 0, 0, 0, 0; ...
25, 0, 0, 0, 0, 0, 0, 0, 0, 0; ...
0, 0, 0, 0, 0, 0, 0, 0, 0, 0; ...
0, 0, 0, 0, 0, 0, 0, 0, 0, 0; ...
0, 0, 0, 28, 0, 25, 0, 0, 26, 0; ...
28, 0, 0, 0, 0, 0, 0, 0, 0, 0; ...
33, 0, 26, 0, 0, 0, 0, 0, 0, 25];
[X,Y,Z]=find(A);
[x,y]=find(A==0);
z=griddata(X,Y,Z,x,y,'cubic');
n=length(x);
for i=1:n, A(x(i),y(i))=z(i); end
0, 0, 0, 0, 0, 0, 0, 0, 0, 0; ...
0, 0, 25, 0, 0, 0, 0, 0, 0, 0; ...
0, 0, 0, 0, 0, 25, 0, 0, 0, 0; ...
25, 0, 0, 0, 0, 0, 0, 0, 0, 0; ...
0, 0, 0, 0, 0, 0, 0, 0, 0, 0; ...
0, 0, 0, 0, 0, 0, 0, 0, 0, 0; ...
0, 0, 0, 28, 0, 25, 0, 0, 26, 0; ...
28, 0, 0, 0, 0, 0, 0, 0, 0, 0; ...
33, 0, 26, 0, 0, 0, 0, 0, 0, 25];
[X,Y,Z]=find(A);
[x,y]=find(A==0);
z=griddata(X,Y,Z,x,y,'cubic');
n=length(x);
for i=1:n, A(x(i),y(i))=z(i); end
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯