Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

3) Part C : Create a Main Script for Simulation : Main.m Step C-1. Create a script file Main.m which is the main code for

3) Part C : Create a Main Script for Simulation : Main.m\ Step C-1. Create a script file Main.m which is the main code for the simulation of the given 4 objects.\ Step C-2. Reset your system first by using close, clear, clc".\ \ Step C-2. Load the initial data Data0.mat. (= Step A-1)\ Step C-3. Check that the initial data Data0.mat is valid by using your function Input_Check().\ Step C-4. Set the update time interval (dt) and the current time (t) as dt = 0.0005 and t = 0.\ (If there is anything else you need to declare before a simulation, feel free to do it.)\ Step C-5. As the time (t) increases by dt, use your functions Accel.m and Fwd_Euler.m to simulate the\ trajectories of the objects from the initial data until one of the following conditions is met:\ - If ? reaches 1000, stop and display the following message.\ No Collision is Expected.\ - If any of the asteroids collide with Earth first, stop and display the following message.\ Warning : A Collision with Asteroid 2 is Expected at t = 32 \ (The blue-colored values above are decided depending on the simulation result.)\ - We assume a collision if the distance between two bodies becomes less than or equal to 0.02.Step C-2. Reset your system first by using "close", "clear", "clc".\

%

System Reset\ close all; % close All Figure Windows\ clear;

,%

Removes All Variables from the Current Workspace\ clc;

,%

clear Command History\ Step C-2. Load the initial data "Data0.mat". (= Step A-1)\

% Initial Data \ load('Data0.mat');

\ Step C-3. Check that the initial data "Data0.mat" is valid by using your function "Input_Check()".\ Step C-4. Set the update time interval (dt) and the current time (

t

as

dt=0.0005

and

t=0

.\ (If there is anything else you need to declare before a simulation, feel free to do it.)\ Step C-5. As the time (t) increases by dt, use your functions "Accel.m" and "Fwd_Euler.m" to simulate the\ trajectories of the objects from the initial data until one of the following conditions is met:\ If

t

reaches 1000 , stop and display the following message.\ "No Collision is Expected."\ If any of the asteroids collide with Earth first, stop and display the following message.\ "Warning : A Collision with Asteroid 2 is Expected at

t=32

"\ (The blue-colored values above are decided depending on the simulation result.)\ We assume a collision if the distance between two bodies becomes less than or equal to

0.02

.

image text in transcribed
Step C-1. Create a script file "Main.m" which is the main code for the simulation of the given 4 objects. Step C-2. Reset your system first by using "close", "clear", "clc". Step C-2. Load the initial data "Data0.mat". (= Step A-1) Step C-3. Check that the initial data "Data0.mat" is valid by using your function "Input_Check()". Step C-4. Set the update time interval (dt) and the current time (t) as dt=0.0005 and t=0. (If there is anything else you need to declare before a simulation, feel free to do it.) Step C-5. As the time (t) increases by dt, use your functions "Accel.m" and "Fwd_Euler.m" to simulate the trajectories of the objects from the initial data until one of the following conditions is met: - If t reaches 1000 , stop and display the following message. "No Collision is Expected." - If any of the asteroids collide with Earth first, stop and display the following message. "Warning : A Collision with Asteroid 2 is Expected at t=32 " (The blue-colored values above are decided depending on the simulation result.) - We assume a collision if the distance between two bodies becomes less than or equal to 0.02. Step C-5. Every time the new positions of the objects are updated, you need to plot them as following The plot is showing all objects over x[30,30] and y[30,30]

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database And Expert Systems Applications 33rd International Conference Dexa 2022 Vienna Austria August 22 24 2022 Proceedings Part 1 Lncs 13426

Authors: Christine Strauss ,Alfredo Cuzzocrea ,Gabriele Kotsis ,A Min Tjoa ,Ismail Khalil

1st Edition

3031124227, 978-3031124228

More Books

Students also viewed these Databases questions

Question

How does selection differ from recruitment ?

Answered: 1 week ago