I need help with a MATLAB problem. Write a MATLAB function to compute the exponential function directly from the Taylor series: e^x=1+x+X^2/2!+x^3/3!.... The series should end when the last term is less than 10^-6. Test your function against the built in function exp, but be careful not to make x too large-this could cause rounding error. Can anyone help me??

At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.

Get our expert's

answer on brainly

SEE EXPERT ANSWER

Get your free account and access expert answers to this and thousands of other questions.

A community for students.

I need help with a MATLAB problem. Write a MATLAB function to compute the exponential function directly from the Taylor series: e^x=1+x+X^2/2!+x^3/3!.... The series should end when the last term is less than 10^-6. Test your function against the built in function exp, but be careful not to make x too large-this could cause rounding error. Can anyone help me??

Engineering
See more answers at brainly.com
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.

Get this expert

answer on brainly

SEE EXPERT ANSWER

Get your free account and access expert answers to this and thousands of other questions

If we notice that the terms of the Taylor's series are such that the nth term is the previous term multiplied by x/n, considering the initial "1" as the zeroth term. This means that instead of calculating each term from scratch, we only need to multiply the previous term by x/n to get the present term. 1 (term zero) x (term zero * x /1 ) x^2/2! = x* (x/2) x^3/3! = x^2/2! * (x/3) ... the running sum calculated will be the various approximation for exp(x). A check should be incorporated to stop calculations when the term is less than 10^(-6)
I kind of understand what you are saying but I'm confused on how to write the actual code.
Hint: Pseudocode: Function Exp(x) initialize term, sum, n while (term>10^(-6)) term=term*(x/n) sum=sum+term n=n+1 end while return sum Give it a try with Matlab and post your code if you need help.

Not the answer you are looking for?

Search for more explanations.

Ask your own question

Other answers:

OK thanks I will post my code if I need more help
You're welcome! :)
I am still having issues with this code. Can someone help me correct it so that I can run right. Thanks
1 Attachment
This is where defining variables (in English) is important when programming so that we do not confuse the values. In your code, y is used to return the value of the function, which is the sum of the series. That's ok. In the lines while y>10^-6 y=y*(x/n); y represents the value of each term of the series, which is not the sum of the series. Also, y must assume a value before we can do the recursive statement y=y*(x/n) This initial value must be defined before entering the while loop. Similarly, n and sum must be initialized to appropriate values before entering the loop. (n=1, sum=0), Finally, y=sum (because y is the return value equal to sum) must be placed at the end. Try to make corrections and post if you can.

Not the answer you are looking for?

Search for more explanations.

Ask your own question