Lab 3 - Engineering 7: Introduction to Programming for...

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

View Full Document Right Arrow Icon
Engineering 7: Prof. Alexandre Bayen Introduction to Programming for Engineers Spring 2011 Lab 3: Iteration Date Assigned: 5:00pm, Friday – Feb 11. Date Due: 5:00pm, Friday – Feb 18. Note: Do not write a function that calls other m-files you have written. If you want to call other functions you have written, write them as subfunctions. For example, in Problem 5.11, you are asked to write a function that computes numbers that are both Fibonacci and prime. If you wish to write a separate function that computes only Fibonacci or prime numbers, make them subfunctions of myNFibPrimes. Problem 1: Do Problem 5.3 in the Reader. You may assume that A is a one-dimensional array with no duplicate entries and that N is a strictly positive integer smaller than the length of A. Test Cases: >> x = [7,9,10,5,8,3,4,6,2,1]; >> M = myNMax(x, 3) M = 10 9 8 Problem 2: Write a function with header [Q] = myTrigOddEven(M) where Q(i,j) = sin( π /M(i,j)) if M(i,j) is odd, and Q(i,j) = cos( π /M(i,j)) if M(i,j) is even. You may assume that M is a two-dimensional matrix of strictly positive integers. Test Cases:
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 09/07/2011 for the course ENGIN 7 taught by Professor Horowitz during the Spring '08 term at University of California, Berkeley.

Page1 / 4

Lab 3 - Engineering 7: Introduction to Programming for...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online