Asked by Flávio
on 5 Jan 2013

For example, after some calculations to solve my problem, I get y=x^3.

How do I plot that function? I tried to do fplot(@(x) y, limits) but it doesn't work...any solution?

*No products are associated with this question.*

Answer by Walter Roberson
on 5 Jan 2013

ezplot('x^3', limits)

OR

ezplot(@(x) x.^3, limits)

OR

x = linspace(LowerLimit, UpperLimit, NumberofPoints); plot(x, x.^3)

Or more generally if you have a *symbolic variable* y that contains the expression,

f = matlabFunction(y, 'x');

and then

ezplot(f, limits)

or

x = linspace(LowerLimit, UpperLimit, NumberofPoints); plot(x, f(x))

Flávio
on 5 Jan 2013

Thank you man! It was the matlabFunction that I needed!

Walter Roberson
on 5 Jan 2013

Accept this Answer ?

Related Content

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn moreOpportunities for recent engineering grads.

Apply Today
## 0 Comments