MATLAB: How to use the mathmatical constant “e” in conjunction with a vector.

mathmatical constant "e"vector

I am trying to use the mathmatical constant "e" in conjunction with a vector and each time i rum my script i tells me that the " * " is wrong. I have narrowed it down by removign things one piece at a time and everything runs great until i add the e back into my script. i saw somewhere that you can use exp() to make it work but in conjunction with the rest of the function i am not getiing it to work.

Best Answer

Your problem isn't the e, it's that the two parts you're trying to multiply are both vectors, hence you need .* instead of *:
f = 22*cos(15*pi*t) .* e.^(-0.5*t);
% ---vector--- ---vector--
But, as Wayne King says, don't use e.^x, use exp(x):
f = 22*cos(15*pi*t) .* exp(-0.5*t);