How to interpolate to fill zeros in two-dimensional data
3 ビュー (過去 30 日間)
古いコメントを表示
load power
L2 = 200;
unitstep = 1;
% xv = (unique([L2:-unitstep:0,0:-unitstep:-L2],'stable')); % +L/2 부터 -L/2 까지 unit-step 행렬생성
% yv = (unique([L2:-unitstep:0,0:-unitstep:-L2],'stable')); % -L/2 부터 +L/2 까지 unit-step 행렬생성
xv = unique(0:400,'stable'); % +L/2 부터 -L/2 까지 unit-step 행렬생성
yv = unique(0:400,'stable'); % -L/2 부터 +L/2 까지 unit-step 행렬생성
[X, Y] = meshgrid(xv,yv);
F_mesh = [X(:),Y(:)]; % 1열 행렬로 변환
Nf = size(F_mesh,1);
xvv = xv; yvv = yv;
Nx = numel(xvv); Ny = numel(yvv);
figure(1)
subplot 121
imagesc(xvv,yvv,power);
axis equal
xlim([0 400])
ylim([0 400])
set(gca,'YDir','normal')
subplot 122
surf(xvv, yvv, power,'EdgeColor', 'none','FaceColor','interp')
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1436573/image.png)
When measuring, important parts were measured in detail due to time issues, but other parts were measured at 3mm intervals.
The yellow part is the part where the yellow part is 0 in the part measured at 3mm intervals, and I want to get a code that fills the yellow part between the circles using interpolation.
please.
0 件のコメント
回答 (1 件)
Chunru
2023 年 7 月 18 日
load(websave("power.mat", "https://www.mathworks.com/matlabcentral/answers/uploaded_files/1436568/power.mat"))
whos
L2 = 200;
unitstep = 1;
% xv = (unique([L2:-unitstep:0,0:-unitstep:-L2],'stable')); % +L/2 부터 -L/2 까지 unit-step 행렬생성
% yv = (unique([L2:-unitstep:0,0:-unitstep:-L2],'stable')); % -L/2 부터 +L/2 까지 unit-step 행렬생성
xv = unique(0:400,'stable'); % +L/2 부터 -L/2 까지 unit-step 행렬생성
yv = unique(0:400,'stable'); % -L/2 부터 +L/2 까지 unit-step 행렬생성
[X, Y] = meshgrid(xv,yv);
F_mesh = [X(:),Y(:)]; % 1열 행렬로 변환
Nf = size(F_mesh,1);
xvv = xv; yvv = yv;
Nx = numel(xvv); Ny = numel(yvv);
figure(1)
subplot 121
imagesc(xvv,yvv,power);
axis equal
xlim([0 400])
ylim([0 400])
set(gca,'YDir','normal')
subplot 122
surf(xvv, yvv, power,'EdgeColor', 'none','FaceColor','interp')
figure
subplot(121)
power1 = power;
power1(power1 > -0.2) = "nan";
power2 =fillmissing2(power1, "natural");
imagesc(xvv,yvv,power2);
axis equal
xlim([0 400])
ylim([0 400])
set(gca,'YDir','normal');
subplot(122)
surf(xvv, yvv, power2,'EdgeColor', 'none','FaceColor','interp')
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Surface and Mesh Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!