Answered step by step
Verified Expert Solution
Question
1 Approved Answer
need help fixing this script 1. (Submit on zyLabs) Please download GLaDOShaywire m This is a broken MATLAB file for a function that should be
need help fixing this script
1. (Submit on zyLabs) Please download GLaDOShaywire m This is a broken MATLAB file for a function that should be called GLaDOS. Please fix the filename. In addition to fixing that you must fix a mumber of other things with this file. When properly fimctioning. GLaDOS is an Al that is capable of performing a series of experiments based on the inputs. The function GLaDOS should take four inputs, each an array of equal length containing the data for a series of tests, and retum an output, the result of each test. The four inputs are arrays formatted in the following way. Each test has three different indicators of success: a button, a leaver, and a laser. Each test also has a difficulty level. The difficulty levels are all either 1, 2, or 3, and the indicators are all either 0 or 1. The result of each test should be an element in an array that is either successful (I) or not successful (0). The results of each test are determined by the following rules: If difficulty is 1, one or more of the indicators needs to be true to pass the test. If the difficulty is 2, two or more of the indicators needs to be true to pass the test If the difficulty is 3, all of the indicators need to be true to pass the test. If the difficulty is not 1, 2 or 3, the test fails. However, none of this is clear from the haywire m file! You need to fix it by: Fiting all of the variable names! The program does not consistently use the same name for each variable. Choose new variable names that are more descriptive Fix test results so they are assigned correctly. arhite mereudedding comments to describe wher function [res] GLaDOS(bn, ls, lv,d) r = zeros( lgth(bn), 1); for i = 1: len(bn) switch dif[i] case 3 if bri] && le[i] && la[i] tstR = 1; = R = 1; end case 2 if b[i] && 1[:]v || b[i] && lai) || iv[i] && la[i] R = 0; else R = 0; case 1 if b[1] || la[:] || lv[i] tr = 1; tsR = 1; end otherwise tstR = = 0; end res(i) = tR; end Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started