plot sin between 0 and 10 in matlab

To plot the sine function between 0 and 10 in MATLAB, you can use the plot function along with the sin function. Here's the code:

main.m
x = linspace(0, 10, 1000);
y = sin(x);

plot(x, y)
xlabel('x')
ylabel('sin(x)')
title('Plot of sin(x) between 0 and 10')
grid on
129 chars
9 lines

In this code, we use the linspace function to create an array of 1000 equally spaced points between 0 and 10. Then, we calculate the sine of each point using the sin function. Finally, we use the plot function to plot the values of x against the corresponding values of y.

The resulting plot will show the sine function between 0 and 10 on the x-axis.

related categories

gistlibby LogSnag