plot(XX,YY,'b'); hold on;
xmax=max(XXXX);
ymax=max(YYYY);
plot(xmax-XXXX,ymax-YYYY,'k');
clear; clc; clf
load('XX.mat');
load('YY.mat');
load('XXXX.mat');
load('YYYY.mat');
plot(XX,YY,'b', 'DisplayName', 'XX,YY'); hold on;
x=XXXX;
y=YYYY;
xx=[max(x) min(x)];
yy=[min(y) max(y)];
slope = (yy(2)-yy(1))/(xx(2)-xx(1))
intercept = yy(1)-xx(1)*slope
perpSlope = -1/slope;
yInt = y - perpSlope.*x;
xintersect = (yInt-intercept)/(slope-perpSlope);
yintersect = slope*xintersect + intercept;
xs = x - xintersect;
ys = y - yintersect;
xr = xs * cos(pi) - ys * sin(pi);
yr = xs * sin(pi) + ys * cos(pi);
xFinal = xr + xintersect;
yFinal = yr + yintersect;
plot(xFinal, yFinal, 'k', 'DisplayName', 'ReflectedData')
rh = refline(slope, intercept);
rh.DisplayName = 'ReflectionLine';
legend()