Description
Please help me the Matlab questions!!Attached file is the requirement!!Thank you very much!!!
1 attachmentsSlide 1 of 1attachment_1attachment_1
Unformatted Attachment Preview
HW for MATLAB
Please submit your homework on Canvas by October 11, 2020.
1. Write down the MATLAB commands for each of the following tasks.
(a) Evaluate
101 2
X
i
2π(i − 1)
sin
.
2π
100
i=1
(Hint: sum)
(b) Construct a 50 × 50 matrix, A, and fill in even numbers from 2 to
5000 column-wise, i.e. the first column is 2, 4, 6, 8, · · ·, the second
is 102, 104, 106, 108, · · ·, and so on. (Hint: reshape)
(c) Create a new matrix B containing the even rows and the odd columns
of A.
(d) Construct the following matrix
1 −1 0
−1 2 −1
0 −1 3
C=
..
.
0 ··· 0
0 ··· ···
···
0
−1
..
.
−1
0
···
···
0
..
.
0
0
···
.
119 −1
−1 120
(Hint: diag)
(Note: You need to submit the m-file containing all the MATLAB commands for the above tasks.)
1
2. The following differential equations describe the motion of a spaceship in
orbit about the earth (located at the origin) and the moon located at (1,0).
The derivatives are respect to time:
x00
y 00
µ0 (x + µ) µ(x − µ0 )
−
− f x0 ,
r13
r23
µ0 y µy
= −2×0 + y − 3 − 3 − f y 0 ,
r1
r2
=
2y 0 + x −
with
µ=
p
p
1
, µ0 = 1 − µ , r1 = (x + µ)2 + y 2 , r2 = (x − µ0 )2 + y 2 .
82.45
(a) By plotting the orbit y(t) versus x(t) with initial conditions
x(0) = 1.2 , x0 (0) = 0 , y(0) = 0 , y 0 (0) = −1.04935751 ,
show that when f = 0, the orbit is periodic with the period T =
6.19216933. You may use the MATLAB function ode45 to solve the
ODE numerically.
(b) With the same initial conditions as in (a), but with f = 1, solve the
differential equations from t = 0. Plot the orbit to show that the
spaceship eventually crashes.
(c) Repeat the computation of (b) with f = 0.1. Can you guess what is
happening?
(Note: You need to submit the m-files for producing the plots in (a),
(b) and (c) and the image files of the plots. Also, please provide the
description of what happens to the spaceship that you can see from the
plot of (c).)
2
Purchase answer to see full
attachment
Tags:
MATLAB commands
matrix B
even rows
M file
odd columns
User generated content is uploaded by users for the purposes of learning and should be used following Studypool’s honor code & terms of service.
Reviews, comments, and love from our customers and community: