making a time vector
Show older comments
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 Comment
KSSV
on 5 Feb 2019
Home Work..wher is your attempt?
Answers (1)
KSSV
on 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
Categories
Find more on Graphics Performance in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!