Hello...I am making a basic program that has the original function, the derivative, and the integral. I then am trying to have it graph them all on the same graph but for some reason it's not working. Every time I run the program an error comes up that says:
Error using plot Non-numeric data is not supported in 'Line'
Is this because I have x declared as a variable using syms x? If so, how do I keep x as a variable but still have it graph?
Thank you!
clc
clear
syms x;
O = 2*x;
display('Original Function')
pretty(simplify(O))
D = diff(O);
display('Derivative')
pretty(simplify(D))
I = int(O);
display('Integral')
pretty(simplify(I))
B = -10:1:10;
plot(B,O,'k--',B,D,'g--',B,I,'r--');
xlabel('x')
ylabel('y')
title('Original, Derivative, Integral')
grid on