Assignment 3 - Solutions - NAME SID LAB SECTION February 9,...

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

View Full Document Right Arrow Icon
NAME LAB SECTION SID February 9, 2007 Assignment 3: Functions by Restriction and Simple Recursion 100 pts for problems Formatting: (-1 if any part of heading is incorrect, -1 for no assignment title, -1 if no page numbering, -1 if problems not numbered and labeled, -1 if incorrect filename or not in pdf format) take off all allotted points for each formatting aspect if any of each is not correct Problem 1: Getting to Know Boolean Operators (10) 1.1 Matlab uses a 1 to denote a true statement. Matlab uses a 0 to denote a false statement. +1 for both right 1.2 Note there are infinitely many possible input pairs. These are just examples. The important thing is that the outputs are 1. EDU>> gt(2,1) ans = 1 EDU>> lt(1,2) ans = 1 EDU>> eq(1,1) ans = 1 EDU>> ge(2,1) ans = 1 EDU>> le(1,2) ans = 1 EDU>> ne(0,1) ans = 1 +1 for all ones 1.3 EDU>> and(or(1,0), xor(0,1)) ans = 1 +1 1
Background image of page 1

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

View Full DocumentRight Arrow Icon
NAME LAB SECTION SID February 9, 2007 1.4 not(eq()) +1 1.5 function [out] = myGates(input1,input2,input3,input4,input5) % NAME % DATE % myGates: takes in 5 boolean inputs and returns an output modeled after % the figure in Assignment 3 % inputs: input1 to input5, boolean statements % outputs: boolean statement out out = not(and(or(and(input1,input2), input3), xor(input4,input5))); end +2 EDU>> myGates(1,1,0,1,1) ans = 1 +2 EDU>> myGates(1,1,1,0,1) ans = 0 +2 The system works for the first system, and doesn’t work for the second. Problem 2: Modeling Sensor Fault Detection (20) 2.1 = otherwise faulty not off are sidue and sidue if faulty Sensor 13 Re 12 Re 1 = otherwise faulty not off are sidue and sidue if faulty Sensor 23 Re 12 Re 2 = otherwise faulty not off are sidue and sidue if faulty Sensor 23 Re 13 Re 3 +2 for all correct 2.2 function [Sens1, Sens2, Sens3] = myBooleanDiagnoser(Res12,Res23,Res13) % NAME % DATE 2
Background image of page 2
NAME LAB SECTION SID February 9, 2007 % myBooleanDiagnoser: models triple redundancy. finds sensors errors given % residues. % input: three boolean expressions representing the residues of the sensors % output: boolean expressions representing whether the sensors are faulty % or not. Sens1 = not(and(Res12,Res13)); Sens2 = not(and(Res12,Res23)); Sens3 = not(and(Res13,Res23)); end +2 EDU>> [Sensor1, Sensor2, Sensor3] = myBooleanDiagnoser(0, 1, 1) Sensor1 = 1 Sensor2 = 1 Sensor3 = 0 +2 EDU>> [Sensor1, Sensor2, Sensor3] = myBooleanDiagnoser(1, 0, 1) Sensor1 = 0 Sensor2 = 1 Sensor3 = 1 +2 EDU>> [Sensor1, Sensor2, Sensor3] = myBooleanDiagnoser(1, 1, 0) Sensor1 = 1 Sensor2 = 0 Sensor3 = 1 +2 2.3 = otherwise faulty not tolerance exceeds Sensor and Sensor of difference and tolerance exceeds Sensor and Sensor of difference if faulty Sensor 3 1 2 1 1 3
Background image of page 3

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

View Full DocumentRight Arrow Icon
NAME LAB SECTION SID February 9, 2007 = otherwise faulty not tolerance exceeds Sensor and Sensor of difference and tolerance
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 13

Assignment 3 - Solutions - NAME SID LAB SECTION February 9,...

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

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