Ace My Grades
Sign In
Sign In
Reset Password
Register
  • Home
  • Tutorials
    • Accounting
    • Business
    • Law
    • Finance
    • Health Care
    • Management
    • Science
    • Political Science
    • Computer Science
  • My Account
  • Contact Us
$24.00 $15.00
CITS2401 Computer Analysis & Visualisation — Lab4 | Problem 8
William Thompson
1

Description

CITS2401 Computer Analysis & Visualisation — Lab4 | Problem 8

8. Writing a small Matlab function that involves using a for loop

A Taylor series is a representation of a function as an infinite sum of terms. Very often we take the first N terms as an approximate value of the function. For instance, the Taylor series for the exponential function ex at x = 0 that stops at the first 6 terms is:

Write a Matlab function called myexp that approximates ex for small x values near 0 using N terms from the Taylor series given above. Your function should have the following heading:

function value = myexp(x, N)

Your function should inspect that N is greater than 2; otherwise, it should issue an error message (by calling Mathab’s built-in error function). You can use the factorial function to compute the factorial.

Save your function to the file called myexp.m.

Compare the output value of your function with Matlab’s built-in function exp function. e.g.,
>> value = myexp(0.1, 5)
>> exp(0.1)
>> value = myexp(-0.2, 10)
>> exp(-0.2)

Take This Course $24.00 $15.00

Lessons

CITS2401 Computer Analysis & Visualisation — Lab4 | Problem 8 | Complete Solution

Take a course to view this content

Related Courses

$25.00 $18.00
CIS 333 | Lab 5 Answers | Complete Solution | Rated A+
William Thompson
3
$25.00 $18.00
CIS 333 | Lab 4 Answers | Complete Solution | Rated A+
William Thompson
3
$25.00 $18.00
CIS 333 | Lab 2 Answers | Complete Solution | Rated A+
William Thompson
4
$30.00 $21.00
CIS 333 | Week 8 Assignment 2 – Identifying Potential Risk, Response and Recovery | Complete Solution | Rated A+
William Thompson
5
Ace My Grades © 2021
  • Home
  • Checkout
  • Blog
  • Privacy Policy
  • Contact Us
  • FAQ