function [YT,TARGETSTIFF] = setTarget(t,YT,TARGETSTIFF,NIBS,Starget,demonumber); % % set target point locations at each time t % % inputs: % t: current time % YT: current target point locations % TARGETSTIFF: current target link stiffnesses % NIBS: numbers of IB points in each IB object % Starget: stiffness for target links % demonumber: which demo was chosen % outputs: % YT: new target point locations % TARGETSTIFF: new target link stiffnesses % if demonumber==3, % % IB object 1 is bottom wall % IB object 2 is top wall % IB object 3 is circle % Only objects 1 and 2 have target points % IB objects 1 and 2 have the same number of IB points % N = NIBS(1); ytopwall = 0.75; ybottomwall = 0.25; V = 1.0; T = 0.2; Amp = 0.25; for k=1:N, j = N+k; yone = YT(k,1); if V*t >= yone & yone >= V*(t-T), YT(k,2) = ybottomwall + Amp*sin( pi*(t - (yone/V))/T); YT(j,2) = ytopwall - Amp*sin( pi*(t - (yone/V))/T); else YT(k,2) = ybottomwall; YT(j,2) = ytopwall; end end end