How to interpolate to fill zeros in two-dimensional data
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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.
0 comentarios
Respuestas (1)
Chunru
el 18 de Jul. de 2023
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 comentarios
Ver también
Categorías
Más información sobre Surface and Mesh Plots en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!