hwk11 - HOMEWORK#11 Due 1 Reading Assignment Complete the...

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

View Full Document Right Arrow Icon
HOMEWORK #11 Due: November 12 – 18 1. Reading Assignment Complete the assigned reading posted on the Course Schedule on the ENGR 126 Blackboard homepage. 2. Debugging Code Part II This section to be completed individually. Identify THREE errors in the code below using the table after the code. Clearly indicate the line number of the error, describe the error and how it could be fixed. Each error counts as one, even if there are multiple errors on the same line. Line Number MATLAB Code 1 function [new_temp]=total_plate(temp_matrix) 2 % This function recalculates the temperature of every position on a heating plate 3 % by averaging the surrounding values. 4 % The input is temp_matrix, the temperature matrix (degrees Celsius) 5 % The output is new_temp, the updated temperature matrix (degrees Celsius) 6 7 % ---- Input Section ---- 8 [n,m] = size(temp_matrix); % Determine the size of the matrix 9 10 % ---- Calculation Section ---- 11 for x = 1:m % Loops through rows of matrix 12 while y = = 1:n % Loops through columns of matrix 13 if r == 1 | r == n | c == 1 | c == m % Calculates edges and corners 14 new_temp(x,y) = temperature_update_corner(temp_matrix,n,m); 15 else % Calculates center section 16 new_temp(x,y) = temperature_update_middle(temp_matrix,x,y); 17 end 18 end 19 end Line number What is the error? How could it be fixed?
Background image of page 1

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

View Full DocumentRight Arrow Icon
Deliverables: A hard copy printout of the three errors identified above.
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/12/2012 for the course ENGR 126 taught by Professor Oakes during the Fall '08 term at Purdue.

Page1 / 4

hwk11 - HOMEWORK#11 Due 1 Reading Assignment Complete the...

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

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