plot sin(x) from 0 to 10 in matlab

main.m
x = linspace(0, 10, 100);
y = sin(x);
plot(x, y);
50 chars
4 lines

Explanation:

  • linspace creates a row vector of 100 evenly spaced points between 0 and 10, inclusive
  • sin function returns the sine value for each element of vector x
  • plot function is used to plot the graph, where x is plotted along the X-axis and y is plotted along the Y-axis.

gistlibby LogSnag