ENGR 132 - QUIZ8

# ENGR 132 - QUIZ8 - ,x x = 12 y = 27 2 for having x =...

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

Click to edit Master subtitle style 4/24/11 ENGR 132 Wed/Fri 3:30-5:30

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

View Full Document
4/24/11 Quiz 8 function [a,b] = My_function(c,d) % header comments a = 0; b = 0; while c <= d counter = 0; while counter < c counter = counter + 1; a = a + counter; end c = a - c; b = c * counter; end >> x=5; >> w=3; >> [x,y] = My_function(w,x) What is output to the command window, when the following code is entered into Matlab? My_function is saved in the current folder.
4/24/11 Solution >> x=5; >> w=3; >> [x,y]=my_function(w

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.

Unformatted text preview: ,x) x = 12 y = 27 +2 for having x = something +2 for having y = something +2 for correct x +2 for correct y +2 for only x and y outputs 4/24/11 Add some fprintf statements to help see what is going on…. %put this statement in inner loop after a = a + counter fprintf(‘Inner Loop: counter=%i, a= %i \n',counter,a,) %put this statement in outer loop after b=c*counter fprintf('Outer Loop: c=%i, b=%i \n',c,b)...
View Full Document

## This note was uploaded on 04/23/2011 for the course ENGR 132 taught by Professor Kutson during the Spring '11 term at Purdue.

### Page1 / 4

ENGR 132 - QUIZ8 - ,x x = 12 y = 27 2 for having x =...

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

View Full Document
Ask a homework question - tutors are online