function [IDDATA] = solve_forward_dynamic(IDDATA,DYDATA,CMDATA) %{ Function for solving the forward dynamic problem. -------------------------------------------------------------------------- Syntax : [FDDATA] = solve_forward_dynamic(KEDATA,EFDATA,CMDATA) -------------------------------------------------------------------------- Function Description : This function built on the state-space developed already integrate the motion to get the results of the forward dynamic problem. -------------------------------------------------------------------------- %} for j = 1:size(IDDATA.t,2)-1 disp(['solving the foward dynamic simulation, Time Stamp : ', num2str(j), '/', num2str(size(IDDATA.t,2)-1)]); % Define the initial conditions if j==1 U0 = [IDDATA.ImposedMotion([1,4,7],1);0;-2e-3;0; IDDATA.ImposedMotion([2,5,8],1);0;0;0]; else U0 = sol.y(:,end); end ti = IDDATA.t(j); tf = IDDATA.t(j+1); options = odeset('RelTol',1e-5,'MaxStep',IDDATA.StepSize); sol = ode45(@(t,u) StateSpace(t,u,j, IDDATA, DYDATA, CMDATA), [ti tf], U0, options); % to use only the feedforward controller change StateSpace_CL to % StateSpace. solutions(j)=sol; end FDDATA = solutions; % Show the Results Comparision IDDATA = show_the_results(IDDATA, FDDATA); return