Solve the equations once and then plug in the values.
for z = 100:105
x1=velprof(z,y1);
x2=velprof(z,y2);
x3=velprof(z,y3);
x4=velprof(z,y4);
c = [ (((x3*y4-x4*y3)*x2^2+(-x3^2*y4+x4^2*y3)*x2+x3*x4*y2*(-x4+x3))*x1^3+((-x3*y4+x4*y3)*x2^3+(-x4^3*y3+x3^3*y4)*x2+y2*x3*x4^3-x3^3*x4*y2)*x1^2+((x3^2*y4-x4^2*y3)*x2^3+(x4^3*y3-x3^3*y4)*x2^2+x3^2*x4^2*y2*(-x4+x3))*x1-x3*x2*x4*y1*(-x4+x3)*(x2-x4)*(x2-x3))/((-x4+x3)*(x2-x4)*(x2-x3)*(x1-x4)*(x1-x3)*(x1-x2)), ...
(((-y2+y1)*x4^2+(y2-y4)*x1^2-x2^2*(y1-y4))*x3^3+((-y1+y2)*x4^3+(y4-y2)*x1^3+x2^3*(y1-y4))*x3^2+((y3-y2)*x1^2+x2^2*(y1-y3))*x4^3+((y2-y3)*x1^3-x2^3*(y1-y3))*x4^2+x1^2*x2^2*(y3-y4)*(x1-x2))/((-x4+x3)*(x2-x4)*(x2-x3)*(x1-x4)*(x1-x3)*(x1-x2)), ...
(((y4-y3)*x2+(y2-y4)*x3-x4*(y2-y3))*x1^3+((y3-y4)*x2^3+(y4-y2)*x3^3+x4^3*(y2-y3))*x1+((-y1+y4)*x3+x4*(y1-y3))*x2^3+((y1-y4)*x3^3-x4^3*(y1-y3))*x2-x3*x4*(-x4+x3)*(x3+x4)*(-y2+y1))/((-x4+x3)*(x2-x4)*(x2-x3)*(x1-x4)*(x1-x3)*(x1-x2)), ...
(((y3-y4)*x2+(y4-y2)*x3+x4*(y2-y3))*x1^2+((y4-y3)*x2^2+(y2-y4)*x3^2-x4^2*(y2-y3))*x1+((y1-y4)*x3-x4*(y1-y3))*x2^2+((-y1+y4)*x3^2+x4^2*(y1-y3))*x2+x3*x4*(-y2+y1)*(-x4+x3))/((-x4+x3)*(x2-x4)*(x2-x3)*(x1-x4)*(x1-x3)*(x1-x2)) ];
disp(z)
disp(c)
end
Best Answer