Thank you for the answers. I got both of them to work for my problem. I am posting here because my next question si very related to my last. I am wondering how to know where to put the @(x) in anaonymous functions that later will take real-valued input. For example, I am trying to plot a function, its linearization and its 2nd order Taylor Polynomial on the same graph. I believe I can do this with ezplot correctly (though I cannot distinguish between the linearization and polynomial at all, so I could very well be wrong), however, I cannot get this to work with using "plot." My basic questions are: how do I know where to put the @ symbol? How does this affect whether or not the function takes real-valued inputs?
%%Taylor Polynomials
syms x
f = @(x) cos(x);
% dydx = diff(@(x) f(x), x);
dydx = @(x) diff(f(x), x);
dy2dx = @(x) diff(dydx(x), x);
a = 0;
% L(x) = f(a) + f'(a)(x-a)
Lx = @(x) f(a) + dydx.*(x-a);
Px = @(x) f(a) + dydx.*(x-a) + dy2dx.*(x-a).^2;
figure(1);
q = ezplot(f(x)); set(q,'Color','b'); hold on;
w = ezplot(Lx(x)); set(w,'Color','r'); hold on;
p = ezplot(Lx(x)); set(p,'Color','g'); hold on;
legend('original','linearization','Polynomial');
axis([-.05, .05, 0.95, 1.05]);
hold off; figure(2);
xnum = -5:0.1:5;
plot(xnum,f(xnum)); hold on;
%Neither of the below will work...
plot(x,dydx(x)); hold on;
plot(xnum,dydx(xnum)); hold on;