To create a plot of y = x^2
in MATLAB, you can follow the steps below:
x
values using the linspace()
function:main.m28 chars2 lines
y
values using the function y = x.^2
:main.m10 chars2 lines
plot()
function:main.m12 chars2 lines
main.m44 chars4 lines
The complete code snippet would look like this:
main.m94 chars7 lines
This will generate a plot of y = x^2
with x
values ranging from -10 to 10 and 200 data points evenly spaced along that range.
gistlibby LogSnag