function z=orbit10b(inter,ic,n,p)
h=(inter(2)-inter(1))/n;        % plot n points
x0=ic(1);vx0=ic(2);y0=ic(3);vy0=ic(4);   % grab initial conds

%%%%%%%%%%%%%%%%%%%%%%%%
%%modified function here
x1=ic(5);vx1=ic(6);y1=ic(7);vy1=ic(8); %initial coordinates for 2 body problem
%%end modification
%%%%%%%%%%%%%%%%%%%%%%%%

y(1,:)=[x0 vx0 y0 vy0 x1 vx1 y1 vy1];t(1)=inter(1);    % build y vector
set(gca,'XLim',[-5 5],'YLim',[-5 5],...
    'XTick',[-5 0 5],'YTick',[-5 0 5]);
sun=animatedline('color','y','Marker','.','markersize',50);
addpoints(sun,0,0)
head=animatedline('color','r','Marker','.','markersize',35);
tail=animatedline('color','b','LineStyle','-');

head1=animatedline('color','r','Marker','.','markersize',35);
tail1=animatedline('color','b','LineStyle','-');
%[px,py]=ginput(1);                % include these three lines
%[px1,py1]=ginput(1);              % to enable mouse support
%y(1,:)=[px px1-px py py1-py];     % 2 clicks set direction
v=VideoWriter('Orbit_10b_video.mp4','MPEG-4');open(v)
for k=1:n/p
  for i=1:p
    t(i+1)=t(i)+h;
    y(i+1,:)=trapstep(t(i),y(i,:),h);
  end
  y(1,:)=y(p+1,:);t(1)=t(p+1);
  clearpoints(head);addpoints(head,y(1,1),y(1,3))
  addpoints(tail,y(1,1),y(1,3))
  drawnow;

  %%%Draw y2?%%%%
 % y(1,:)=y(p+1,:);
  clearpoints(head1);addpoints(head1,y(1,5),y(1,7))
  addpoints(tail1,y(1,5),y(1,7))
  drawnow;
  frame=getframe;writeVideo(v,frame);
end
close(v)
function y=eulerstep(t,x,h)
%one step of the Euler method
y=x+h*ydot(t,x);

function y = trapstep(t,x,h)
%one step of the Trapezoid Method
z1=ydot(t,x);
g=x+h*z1;
z2=ydot(t+h,g);
y=x+h*(z1+z2)/2;

function z = ydot(t,x)
m1=0.05;g=1;mg1=m1*g;
m2=0.5;g=1;mg2=m2*g;px2=x(5);py2=x(7);
px1=x(1);py1=x(3);vx1=x(2);vy1=x(4);
vx2=x(6);vy2=x(8);
dist=sqrt((px2-px1)^2+(py2-py1)^2);
z=zeros(1,8);
z(1)=vx1;
z(2)=(mg2*(px2-px1))/(dist^3);
z(3)=vy1;
z(4)=(mg2*(py2-py1))/(dist^3);
z(5)=vx2;
z(6)=(mg1*(px1-px2))/(dist^3);
z(7)=vy2;
z(8)=(mg1*(py1-py2))/(dist^3);
Not enough input arguments.

Error in orbit10b (line 2)
h=(inter(2)-inter(1))/n;        % plot n points