Recitation 08 Problems

# Recitation 08 Problems - 14:440:127 Introduction to...

This preview shows pages 1–2. Sign up to view the full content.

14:440:127 Introduction to Computers for Engineers Recitation 8- Problems for students to attempt Please complete these problems on your own time if you do not finish in recitation. You don’t need to show us the completed recitation problems, although we recommending saving a copy of your solutions for your own benefit. 1. Create an anonymous function f = x + 5. Create another anonymous function g = 2*x.^2. Now create h = g(f(x)) and evaluate its value at x=2. 2. Create a function which takes a matrix of arbitrary size and returns a vector containing the minimum, mean and maximum element in it. Then test it, giving an arbitrary matrix as input. 3. Write your own sign function 'mysign(x)'. Given any numbers x, mysign(x) should return +1 if x > 0; 0 if x = 0; - 1 if x < 0. 4. Write a user-defined function 'sumsquare(N)'to calculate 1^2 + 2^2 + . .. + (N-1)^2 + N^2. For example, sumsquare(4) = 30. 5. Write a Matlab function that returns the area and circumference of a circle for the given radius ‘ r ’. If the user requests a single output, return a 2 element vector with both the area and circumference. If the user requests two outputs, return the area and circumference separately.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 2

Recitation 08 Problems - 14:440:127 Introduction to...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online