联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp

您当前位置:首页 >> Matlab编程Matlab编程

日期:2018-09-07 04:06


CS314 Numerical Methods

Fall 2018

Homework 01

Due 11:59PM, Thursday, Sept 6, 2018

*** Homework must be submitted via Blackboard in PDF file format. The PDF file (i.e. the main

file) should include Matlab code (if necessary) and also the Matlab code should be uploaded in

separate files (i.e., .m files).

*** Your PDF file should be named as follows: FistnameLastnameHWxx.pdf, where xx represents

the homework number, e.g., 01.

*** You should write up your own solution, and you are not permitted to share or copy someone

else’s written solution or code. All projects are individual projects.

1. (10 points) In this problem, there are three raptors, denoted by r0, r1 and r2, at the corner of

an equilateral triangle and you are standing in the middle. Specifically, we assume the coordinates

of r0, r1 and r2 are (0, d), (−d

3/2, −d/2) and (d

3/2, −d/2), respectively. Your coordinate is

(0, 0). That is, the distance between you and any of the raptors is d meters. The raptors all run

towards you at different speeds with r0, r1 and r2 being 16 m/s, 12 m/s and 14 m/s, respectively.

Your speed is 8 m/s. Assume that you only pick your direction in the beginning and stick to this

direction. Find the direction that maximizes your survival time (you can use the code given to you

as the starting point). What is the optimal direction (to within a degree) and how long before you

get eaten by one of the raptors. For this case, also show the plot of all entities and their movement.

Show the plot for d = 40 for the best angle, and print the time.

Also, write the equations governing the movement of raptors.

2. (20 points) Changing the scenario in Problem 1, we now assume that you can change your

direction as well. You run for a fixed period of time (say, dt). After this, you re-evaluate your

direction to pick the best direction from that instant. You keep running in this manner. How long

before you get caught? Plot the trajectories for this case for dt = 0.02s. All other parameters stay

the same. Also, set up a constraint of the max time T = 10s or the max time step N = T /dt in

your code, and print out a message showing the raptors cannot catch in time T.

Highlight changes in equations from the solution to problem 1.

3. (40 points) In this problem, there is only one raptor, which is on the same line as you (say,

x-axis). The raptor spots you 50 meters away and runs towards you, accelerating at 4 m/s2 up

to its maximum speed of 25 m/s. You run with an acceleration of 2 m/s2 and your maximum

speed is 8 m/s. How long before you get caught? Write a Matlab program to simulate this process.

1

Furthermore, if the distance between you and the raptor is d meters and it takes time of t seconds

before you get caught, write a mathematical expression of t in terms of the distance d. Note:

For clarity, assume the rapator is at (0, 0) and you are at (0, d) in the beginning. Both run along

x-axis. When you write a Matlab program, you can use the criterion that you get caught whenever

the distance between you and the rapator less than a small number (e.g, 0.1).

Hint: The mathematical expression t(d) is a piecewise function in terms of d. Both your speed

and the raptor’s speed are linear functions of time t, due to the acceleration and the maximum speed.

4. (30 points) Problem 5, Chapter 1 in the textbook.

2


版权所有:编程辅导网 2021 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。 站长地图

python代写
微信客服:codinghelp