Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

7. Most engineering systems have redundancy. That is, an engineering system has

ID: 640204 • Letter: 7

Question

7. Most engineering systems have redundancy. That is, an engineering system has more than is required to accomplish its purpose. Consider a nuclear reactor whose temperature is monitored by three sensors. An alarm should go off if any two of the sensor readings disagree. Write a function with header [response] = myNukeAlarm(S1, S2, S3) where S1, S2, and S3 are the temperature readings for sensor I, sensor 2, and sensor 3. respectively. The output response should he the string alarm! if any two of the temperature readings disagree by strictly more than 10 degrees and normal otherwise. Test Cases: ? response ? rnyNukeAlarm(94,96,90) response = normal > response myNukeAlarm(94, 96, 80) response = alarm! ? response myNukeAlarm(100,96,90) response = normal

Explanation / Answer

This works, comments included

"function [response] = myNukeAlarm(S1, S2, S3)
diff1 = abs(diff([S1, S2])); %take the absolute value of the difference between each temperature
diff2 = abs(diff([S1, S3]));
diff3 = abs(diff([S2, S3]));
if(diff1 > 10 || diff2 > 10 || diff3 > 10)
response = 'alarm!'; %if the any of the differences are greater than 10, response = alarm!
else
response = 'normal'; %else the response is normal
end

end"

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote