Paulo e Walmes, <div><br></div><div>encontrei a seguinte forma para resolver o problema, gostaria que dessem uma olhada </div><div><br></div><div>#dados do limite da borda direitra</div><div><div>y=c(-26.0000,-25.9862,-25.9343,-25.8822,-25.8433,-25.8054,-25.7948,-25.7872,-25.7668,-25.7284,-25.7015,-25.6282,-25.4612,-25.3016,-25.2564,-25.2412,-25.2412,-25.2232,-25.0869,-25.0000,-25.0000,-24.9856,-24.9397,-24.8976,-24.8533,-24.6587,-24.6373,-24.5740,-24.5406,-24.4379,-24.3934,-24.3628,-24.3277,-24.3042,-24.2972,-24.2973,-24.3020,-24.3068,-24.3068,-24.2956,-24.2920)</div>

<div>x=c(-45.8529,-45.8302,-45.7575,-45.6680,-45.6107,-45.5050,-45.4574,-45.4058,-45.3538,-45.2913,-45.2634,-45.2264,-45.1667,-45.0719,-45.0213,-45.0000,-45.0000,-44.9748,-44.8726,-44.8405,-44.8405,-44.8351,-44.8259,-44.7972,-44.7764,-44.6867,-44.6674,-44.5912,-44.5587,-44.4927,-44.4515,-44.4115,-44.3314,-44.2664,-44.2171,-44.1729,-44.1288,-44.0820,-44.0509,-44.0118,-44.0000)</div>

<div><br></div><div># partícula 1</div><div>amostra=c(x=-45.3,y=-25.111)</div><div><br></div><div># inserir dados das amostras no limite</div><div>x[length(x)+1]=amostra['x']</div><div>y[length(y)+1]=amostra['y']
</div><div><br></div><div>#criar polinomio</div><div>m=lm(y~poly(x,3))</div></div><div><br></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:9.600000381469727px;background-color:rgb(255,255,255)">xpred <- data.frame(x = seq(min(x), max(x), len=250))</span>
</div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:9.600000381469727px;background-color:rgb(255,255,255)"><br></span></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:9.600000381469727px;background-color:rgb(255,255,255)">#plotar dados</span></div>

<div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:9.600000381469727px;background-color:rgb(255,255,255)">plot(y,x)</span></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:9.600000381469727px;background-color:rgb(255,255,255)">lines(xpred$x, predict(m, newdata=xpred)) </span></div>

<div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:9.600000381469727px;background-color:rgb(255,255,255)"><br></span></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:9.600000381469727px;background-color:rgb(255,255,255)">if(abs(resid(m[length(m)]))<0.1 or  </span><span style="background-color:rgb(255,255,255);color:rgb(34,34,34);font-family:arial,sans-serif;font-size:9.600000381469727px">resid(m[length(m)]))<0</span><span style="background-color:rgb(255,255,255);color:rgb(34,34,34);font-family:arial,sans-serif;font-size:9.600000381469727px"> )</span></div>

<div><span style="background-color:rgb(255,255,255);color:rgb(34,34,34);font-family:arial,sans-serif;font-size:9.600000381469727px">i='dentro'</span></div><div><span style="background-color:rgb(255,255,255);color:rgb(34,34,34);font-family:arial,sans-serif;font-size:9.600000381469727px">else i='fora'</span></div>