Originally Posted by

**fearless901** hey guys just started matlab class, and need guidance through this homeork problem, lets say i ant function f(x)= x^3 range from 0 to 5 how do i put that into matlab. and am i suppose to put the function show next to the graph into matlab?? thanks alot guys

You can use this code:

Code:

x=[0:1:5];
y=x.^3;
plot(x,y)

line 1: set x-values

line 2: here's your equation -- note the .^ operator

line 3: create the plot

P.S. the .^ operator means raise each element of the array to the power. In your case the array is from 0 to 5 with step size 1 i.e. [1,2,3,4,5]