x=-6:6;[y]=f(x);plot(x,f(x))grid on% (b)
%Determine f(3)-f(5)
[y]=f(x);ans = f(3) - f(5);%Determine definite integral
[y]=f(x);int_ans=integral(f(x),-6,6);with my function file f.m looking like this:function [y] = f(x)y = (x.^3 - x.^2 + 2*x + 1);end
MATLAB: How to get the integral of this function I created
functionintegrationMATLABmatlab function
Best Answer