Question & Answer: Use the Programming Language —- > MATLAB…..

Use the Programming Language —- > MATLAB <—

Preset rpm speeds 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. Setting RPM 3500 6125 9000 Ex: If presetValue is 1, then rpmsetting is 3500. Your Function Save Reset MATLAB Documentation I function rpmSetting = SetCentrifugespeed (pre setvalue) 2 % Write a switch statement to assign rpmsetting with % the appropiate value given pres evalue rpmSetting 0; 4 5 6 7 end Code to call your function C Reset 1 SetcentrifugeSpeed (1)

Question & Answer: Use the Programming Language ---- > MATLAB..... 1

Preset rpm speeds 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. Setting RPM 3500 6125 9000 Ex: If presetValue is 1, then rpmsetting is 3500. Your Function Save Reset MATLAB Documentation I function rpmSetting = SetCentrifugespeed (pre setvalue) 2 % Write a switch statement to assign rpmsetting with % the appropiate value given pres evalue rpmSetting 0; 4 5 6 7 end Code to call your function C Reset 1 SetcentrifugeSpeed (1)

Expert Answer

 

Matlab Code
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 3
rpmSetting = 9000;
otherwise % For value other than 1,2 and 3
rpmSetting = 0;
end
return
end

Instructions: Open Matlab, type edit SetCentrifugeSpeed at command and hit enter and ok. A new m file with name SetCentrifugeSpeed.m will get created. After then copy the above code and paste it into the SetCentrifugeSpeed.m file. Now again come to the command window and type SetCentrifugeSpeed(1)and hit enter, you will get the output.

OUTPUT

Question & Answer: Use the Programming Language ---- > MATLAB..... 2

Still stressed from student homework?
Get quality assistance from academic writers!