A centrifuge has four preset speeds. Write a switch statement that assigns rpmSetting with the appropriate rpm speed given presetValue. If the presetValue does not match any of the preset values defined, then assign rpmSetting with 0. Ex: If presetValue is 1, then rpmSetting is 3500. Code to call your function when you click Run

Respuesta :

The required program is given below in MATLAB using a switch statement in which based on the variable presetValue, a number is assigned to the variable rpmSetting. For example, for presetValue equals to 1, rpmSetting  will be 3500, for presetValue equals to 2, rpmSetting  will be 6125, for presetValue equals to 3, rpmSetting  will be 9000. If presetValue does not has any matching value with defined one i.e 1,2,3 then rpmSetting  is assigned with 0.

function rpmSetting = SetCentrifugeSpeed(presetValue)

% Switch_case

switch presetValue

case 1 % For value 1

rpmSetting = 3500;

case 2 % For value 2

rpmSetting = 6125;

case 3 % For value 9000

rpmSetting = 6125;

rpmSetting = 0;

end

"

Complete question:

A centrifuge has four preset speeds. Write a switch statement that assigns rpmSetting with the appropriate rpm speed given presetValue. Ex: If presetValue is 1, then rpmSetting is 3500,  If presetValue is 2, then rpmSetting is 6125,  If presetValue is 3, then rpmSetting is 9000. If the presetValue does not match any of the preset values defined, then assign rpmSetting with 0. Code to call your function when you click Run

"

You can learn more about MATLAB at

https://brainly.com/question/13974197

#SPJ4