MATLAB: Error using function fplot

fplot

When typing my code, I keep getting the error of invalid parameter from fplot. Not sure why it keeps coming up. How would I fix this?
Code:
syms x
f(x) = log(x)^4 * exp((-x)^3) * x^2;
val = int(f(x),x,[0,Inf]);
vpa(val)
X = [0.5 : 0.1 : 2.5]
fplot(@(x) f(x),X,'b')

Best Answer

  • You need to specify range with two numbers.
    syms x
    f(x) = log(x)^4 * exp((-x)^3) * x^2;
    val = int(f(x),x,[0,Inf]);
    fplot(@(x) f(x), [0.5 2.5],'b')