36.3k views
5 votes
What is the MATLAB command that creates a simple line plot of a function f(x), where f is plotted on the y-axis and x is plotted on the x-axis? Suppose that the vectors x and f have already been defined.

(Enter your answer in the format that is acceptable in MATLAB) (Don't use any spaces in your answer.)
Given x and f, the following MATLAB command is valid: plot(x,f,'..')
Select one:
a. True
b. False

User Sajee
by
8.0k points

1 Answer

3 votes

Final answer:

The statement is true; the MATLAB command plot(x,f,'..') plots the vectors x and f, creating a scatter plot with dots. To create a simple line plot, you should use plot(x,f) without any style arguments.

Step-by-step explanation:

The MATLAB command to create a simple line plot of a function f(x), given that vectors x and f have already been defined, is plot(x,f). Using plot(x,f,'..') is indeed a valid command; however, it denotes a plot style that places a dot at each data point instead of a simple line. Therefore, the provided command will create a scatter plot with dots, not a line plot. In MATLAB, when you want to connect the dots with a line, you simply need to omit the style argument or use a line style indicator like '-'. The command without any style arguments defaults to a line plot. The statement given is True as the command will generate a plot, but the plot style may not be as expected for a simple line plot.

User Dudeldidadum
by
8.2k points