Lab Assignment 6 - Assigned: September 30, 2011 Fall 2011...

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

View Full Document Right Arrow Icon

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

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

Unformatted text preview: Assigned: September 30, 2011 Fall 2011 Due: October 7, 2011 E7 Laboratory Assignment 6 The purpose of this lab is to produce an environment that will simulate the game Mastermind. See the lecture slides for an explanation of the rules of the game. Weve provided you with all the working functions of the MATLAB Mastermind environment. These files are hidden though (using the p-code tool), so you will not be able to turn them in for credit. Rather, you will explore their features and make your own copies of them that mimic those features. If you get stuck on one function, move on to the next function. Many functions will be dependent on each other. You are free to use the functions we provide you in your own functions as dependencies, but you will only receive credit for functions you write yourself. Note: You will use MATLABs publish command (accessible in the Editor window via File -> Publish Filename ) to generate a printable document that contains your code and your answers. 1. You must turn in a printed copy to the homework boxes in room 1109 Etcheverry. Further, you will need to use the command type to display your functions in your main script. You will not get credit for the functions you have written unless you display them! Be sure to turn your printout into the box corresponding to the lab section in which you are registered. The due-date is 12:00 pm (noon) on October 7, 2011. 2. Your primary m-file, which is used to generate the HTML document, and all of the function m-files that you create must also be uploaded to bSpace (under the Assignments tab) by noon on October 7, 2011. Please (i) have your full name, student ID number, and lab section number at the head of the file and (ii) name this file lastname middlename firstname lab06.m . Use the clear; format compact commands at the beginning of your script to clear the variables from the base workspace and format appropriately to reduce the length of the output. If your comments exceed the page border, highlight the comment and go to Text-> Wrap Comment . In several problems, you are asked to execute a number of given lines, and explain (in a comment before the line) what the command does. Some lines might produce an error (this is deliberate, on our part). In that case, after you understand what is the issue, comment out that line (using the % symbol) in your script file and explain why the error occurred. Part A: Introduction (40 points) 1. (10 points) Run the following lines and explain what the commands do as a whole with a short sentence. begin code 1 A = ; B = [7 4 6 0 1 7 6]; 2 for i = 1:length(B) 3 if B(i)~=B(1) 4 A = [A B(i)]; 1 of 10 Assigned: September 30, 2011 Fall 2011 Due: October 7, 2011 5 end 6 end 7 A end code 2. (15 points) Write a function mykron under the file name mykron.m that has a function declaration line: begin code 1 function C = mykron(A,B) end code The input arguments A and B are numeric arrays of any dimension. For the purposes of expla- nation, suppose the dimensions are...
View Full Document

This note was uploaded on 03/13/2012 for the course E 7 taught by Professor Patzek during the Spring '08 term at University of California, Berkeley.

Page1 / 10

Lab Assignment 6 - Assigned: September 30, 2011 Fall 2011...

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