Hello. I have created a function that inputs a vector of x-values, and outputs the value of the Taylor Polynomial of e^x for said x-values. My objective is to take this data, and output it into a single column using a single fprintf statement, but I have no clue how to do this due to my unfamiliarity with functions. Everytime I tried to output "TaylorExp(x)", I kept getting the output in rows. Note, there is a "Texp" output variable that I had to use within my assignment, but I also did not know where to incorporate it. Here is my code and any assistance would be appreciated.
function [Texp ] = TaylorExp(x) % function definition line
% H1: Computes e^x using a Taylor Series for x>=0
% Help Text:
% x = a vector of exponents, all values x >= 0
% Output Argument:
% Texp = a vector of e^x values computed using a Taylor Series
n=0; % sets iterations
x=[0:0.5:20];while n<1n=n+1;if isinteger(x) ((x)^(n)/factorial(n))else exp(x)endend
Best Answer