I have a function (func) given to me with desired x-values (x). The assignment is to plot func while also plotting the x-intercepts. It appears to me that I am getting the correct values when I check the x/y data points, but the graph does not line up.
x = -10:.1:8;func = (x-6).*((x.^2)-1).*(x+8);plot(func);title("Graph of Function");xlabel("Vector Values");ylabel("Function Values");hold on;%Plots the x-intercepts
[~,cols] = size(func);for i=1:cols if func(i) == 0 plot(x(i),0,'*r') endend
The x-intercepts are correct and the data points are correct; however, my plot does not line up. Not sure what is wrong. Any help would be great!
Best Answer