making a time vector

46 次查看(过去 30 天)
Daniel Sifuentes
Daniel Sifuentes 2019-2-5
回答: KSSV 2019-2-5
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 个)

KSSV
KSSV 2019-2-5
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

类别

Help CenterFile Exchange 中查找有关 2-D and 3-D Plots 的更多信息

产品


版本

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by