making a time vector

44 Ansichten (letzte 30 Tage)
Daniel Sifuentes
Daniel Sifuentes am 5 Feb. 2019
Beantwortet: KSSV am 5 Feb. 2019
2. Create vectors of data a) Create a vector (t) that contains time from 0 seconds to 3 seconds, with a step-size of 0.01 seconds. b) Create a vector (y) that contains the position values for ?(?) = 5 ∙ sin(4? ∙ ?) in meters. c) Create a vector (vel) that contains the velocity values for ?(?) = 20? ∙ ???(4? ∙ ?) in m/s.
3. Plot data a) Make separate plots of y vs. t and vel vs. t. Use pauses in between plots. Make sure to include: i. Appropriate graph title ii. Axis labels and units b) Make a single plot of y vs. t and vel vs. t on the same graph. Make y a solid red line and vel a dashed blue line. Make sure to include: i. Appropriate graph title ii. Axis labels and units (you may simply label the y-axis as Amplitude) iii. Legend (now that multiple lines are on the graph). Your legend should identify the plot of y as position (m) and the plot of vel as velocity (m/s)
  1 Kommentar
KSSV
KSSV am 5 Feb. 2019
Home Work..wher is your attempt?

Melden Sie sich an, um zu kommentieren.

Antworten (1)

KSSV
KSSV am 5 Feb. 2019
a) Create a vector (t) that contains time from 0 seconds to 3 seconds, with a step-size of 0.01 seconds.
Read about linspace.
b) Create a vector (y) that contains the position values for ?(?) = 5 ∙ sin(4? ∙ ?) in meters.
Direct substituion, it is easy.
t = 0:0.001:10 ;
y = 5*sin(4*pi-t) ;
plot(t,y)
c) Create a vector (vel) that contains the velocity values for ?(?) = 20? ∙ ???(4? ∙ ?) in m/s.
Same as above
Plot data a) Make separate plots of y vs. t and vel vs. t.
Read about plot

Kategorien

Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange

Produkte


Version

R2018b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by