필터 지우기
필터 지우기

How to interpolate to fill zeros in two-dimensional data

조회 수: 4 (최근 30일)
장훈 정
장훈 정 2023년 7월 18일
답변: Chunru 2023년 7월 18일
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')
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.

답변 (1개)

Chunru
Chunru 2023년 7월 18일
load(websave("power.mat", "https://www.mathworks.com/matlabcentral/answers/uploaded_files/1436568/power.mat"))
whos
Name Size Bytes Class Attributes cmdout 1x33 66 char power 401x401 1286408 double
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')

카테고리

Help CenterFile Exchange에서 Axis Labels에 대해 자세히 알아보기

제품


릴리스

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by