I need help on MATLAB define this vector in mat lab for a us

I need help on MATLAB!

define this vector in mat lab for a user selected value of x. Find a MATLAB function that will sum the entries of this vector together. compare your answer to MATLAB exp(x) for the same value x. Are your answers the built in function you found appear to do

Solution

n=0:8;
x=input(\'enter a value \');
f=(x.^n)./factorial(n);
disp([\'required vector \' int2str(f)]);
f1=sum(f);
disp([\'vector summation \' int2str(f1)]);
f2=exp(x);
disp([\'exponential of x \' int2str(f2)]);
diff=abs(f1-f2);
disp([\'the difference \' int2str(diff)]);

>> m1
enter a value 2
required vector 1 2 2 1 1 0 0 0 0
vector summation 7
exponential of x 7
the difference 0

I need help on MATLAB! define this vector in mat lab for a user selected value of x. Find a MATLAB function that will sum the entries of this vector together. c

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site