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!