There are many different line specifications that can be used when plotting. Usi
ID: 3562935 • Letter: T
Question
There are many different line specifications that can be used when plotting. Using the documentation at http://www.mathworks.com/help/matlab/ref/linespec.html, answer the following questions:
a) List 2 different line style specifiers, and the line style that they produce (e.g., - is the default solid line).
b) List 2 different color style specifiers and the color they produce (e.g., k is used to specify black).
c) List 2 different marker specifiers and the markers the produce (e.g., p is used to specify pentagram markers)
3) Using your answers to questions 1 and 2, write the MATLAB code to plot y = x2. Be sure to use some of the line specifications that you discussed for question 2.
Explanation / Answer
ANSWER:
a)
- produces solid line e.g. plot(x,y,'-');
: produces dotted line e.g. plot(x,y,':');
b)
b produces blue line e.g. plot(x,y,'b');
g produces green line e.g. plot(x,y,'g');
c)
+ produces +mark e.g. plot(x,y,'+');
* produces * mark e.g. plot(x,y,'*');
3)
x = [1:0.05:3];
y = x.^2;
plot(x,y,'g*:');
The above statement plots the graph in green colour, with * mark at data points and dotted line to join those points.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.