答案 0 :(得分:2)
我假设您拥有用于绘图的x,y坐标。我使用cp /var/www/docs/web.config.txt
在这里获得了它们。我使用imfreehand
为每条曲线生成二元模板,然后对它们应用inpolygon
以获得所需区域的模板:
xor
答案 1 :(得分:1)
function area = area_between_curves(initial,corrected)
interval = 0.1;
x = -80:interval:80;
y = -80:interval:80;
[X,Y] = meshgrid(x,y);
in_initial = inpolygon(X,Y,initial(:,1),initial(:,2));
in_corrected = inpolygon(X,Y,corrected(:,1),corrected(:,2));
in_area = xor(in_initial,in_corrected);
area = interval^2*nnz(in_area);
% visualization
figure
hold on
plot(X(in_area),Y(in_area),'r.')
plot(X(~in_area),Y(~in_area),'b.')
end
如果我使用问题的行,这就是结果:
area = 1.989710000000001e+03