MATLAB Answers

what do '--' and '-.' mean?

21 views (last 30 days)
Estefania Garcia
Estefania Garcia on 25 Sep 2020 at 3:19
Commented: Estefania Garcia on 26 Sep 2020 at 3:19
what do '--' and '-.' mean? I'm new to using Matlab, and I came across this while looking at some examples.

  0 Comments

Sign in to comment.

Accepted Answer

Adam Danz
Adam Danz on 25 Sep 2020 at 3:21
Edited: Adam Danz on 25 Sep 2020 at 3:24
These are line styles.
Also check out the LineSpec input to the plot function.
plot(X,Y,LineSpec)

  3 Comments

Estefania Garcia
Estefania Garcia on 25 Sep 2020 at 3:30
Thanks! Also do the values ([2:n]) mean?
where t = (0:160)';n = length(t);
Adam Danz
Adam Danz on 25 Sep 2020 at 3:47
In the command window, type
help length
It tells you the length of t.
Now try
help :
Using the syntax 2:n, the colon operator counts from 2 and stop at or just before n by intervals of 1.
1.2 : 5
% ans =
% 1.2 2.2 3.2 4.2
Estefania Garcia
Estefania Garcia on 26 Sep 2020 at 3:19
Thank you!!

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by