Question: Using MATLAB Homework 4 - Logicals and Masking Extra Credit Function Name: smashBallThief Inputs 1. 2 3 4, (logical) Vector of suspect #1's answers to
Using MATLAB
Homework 4 - Logicals and Masking Extra Credit Function Name: smashBallThief Inputs 1. 2" 3" 4, (logical) Vector of suspect #1's answers to a lie detector (logical) Vector of suspect #2's answers to a lie detector (logical) Vector of suspect #3's answers to a lie detector (logical) Vector of suspect #4's answers to a lie detector Outputs 1. (char) Sentence stating which suspect stole the smash ball Banned Functions isequal (), isequaln(), strcmp(), strcmpi() Background You are playing in your dorm's Super Smash Bros Ultimate tournament. The stakes are high, and you know your friends would stop at nothing to be the champion. That's when you notice that the Smash Ball has gone missing! You have identified four suspects and given themm a lie detector test You know that each suspect who is telling the truth will have matching answers. However, the thief will having at least one answer that is different from the rest. You have decided to use your neW MATLAB skills to find the true thief Function Description: Each input to the function is a logical vector corresponding to the answers a suspect gives on the lie detector. Each element of the vectors represent a different question. Three of the suspects will have the exact same answers, but one suspect's answers will be slightly-or completely-different than the others' answers. Using your knowledge of logical indexing and masking, determine which of the four suspects is lying, and thus, is the Smash Ball Thief! The output string will be of the form 'Suspect #num stole the Smash Ball!' where
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
