Question
Language: Using MATLAB Thanks in advance Find below options structure options = odeset('Events',@(t,y)end_of_mission_event(t,y,end_event)); experiment1.mat file below alpha_dist: [0 100 200 300 400 500 600 700
Language: Using MATLAB
Thanks in advance
Find below "options" structure
options = odeset('Events',@(t,y)end_of_mission_event(t,y,end_event));
experiment1.mat file below
alpha_dist: [0 100 200 300 400 500 600 700 800 900 1000] alpha_deg: [111 double] crr: 0.1000 initial_conditions: [21 double] time_range: [0 20000]
End of mission file below
function[value, isterminal,direction] = end_of_mission_event(t,y,end_event) % end_of_mission_event.m % % Defines an event that terminates the mission simulation. Mission is over % when rover reaches a certain distance, has moved for a maximum simulation time or has % reached a minimum velocity. %
mission_distance = end_event.max_distance; mission_max_time = end_event.max_time; mission_min_velocity = end_event.min_velocity;
% assume that y(2) is the distance traveled distance_left = mission_distance - y(2) ; time_left = mission_max_time - t; velocity_threshold = y(1)-mission_min_velocity;
value = [distance_left,velocity_threshold,time_left];
isterminal = [1;1;1];
% is terminal indicates whether any of the conditions can lead to the % termination of the ODE solver. In this case all conditions can terminate % the simulation independently.
% direction indicates whether the direction along which the different % conditions is reached matter or does not matter. In this case, only % the direction in which the velocity treshold is arrived at matters %(negative) % direction = [0,-1,0];
simulate rover.m simulate rover General Description This function integrates the trajectory of a rover Calling Syntax rover-simulate_rover (rover,planet,experiment,end event) Input Arquments rover planet experiment Data structure containing the parameters of the rover Data structure containing the planet definition Data structure containing parameters of the trajectory to be followed by the rover Data structure containing the conditions necessary and sufficient to terminate simulation of rover dynamics struct struct struct end event struct Return Arguments Data structure containing the parameters of the rover, including updated telemetry information rover struct Additional Specifications and Notes This function integrates the trajectory of a rover according to the terrain and initial conditions contained in the experiment1.mat file. It uses end_event to define the necessary and sufficient conditions to terminate the simulation. Note that you can use the MATLAB ODE solvers. Please determine the best solver for the particular problem. Note that you need to provide the conditions to stop the simulation using the options structure to be fed into the ode solver: optionsodeset ('Events,e (t,y)end of mission_event (t,y,end event)); You will need to download end of mission event.m from eCampus. This function requires the end event structure Typical call to solver using options follows [T,Y] Odesolver ( differential equation, TSPAN, Initial conditions, options ); The function must check validity of inputs. The function should populate the rover.telemetry structure simulate rover.m simulate rover General Description This function integrates the trajectory of a rover Calling Syntax rover-simulate_rover (rover,planet,experiment,end event) Input Arquments rover planet experiment Data structure containing the parameters of the rover Data structure containing the planet definition Data structure containing parameters of the trajectory to be followed by the rover Data structure containing the conditions necessary and sufficient to terminate simulation of rover dynamics struct struct struct end event struct Return Arguments Data structure containing the parameters of the rover, including updated telemetry information rover struct Additional Specifications and Notes This function integrates the trajectory of a rover according to the terrain and initial conditions contained in the experiment1.mat file. It uses end_event to define the necessary and sufficient conditions to terminate the simulation. Note that you can use the MATLAB ODE solvers. Please determine the best solver for the particular problem. Note that you need to provide the conditions to stop the simulation using the options structure to be fed into the ode solver: optionsodeset ('Events,e (t,y)end of mission_event (t,y,end event)); You will need to download end of mission event.m from eCampus. This function requires the end event structure Typical call to solver using options follows [T,Y] Odesolver ( differential equation, TSPAN, Initial conditions, options ); The function must check validity of inputs. The function should populate the rover.telemetry structureStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started