Using MATLAB software!! Must to User-Defined Fuctions Must to Conditonal stateme
ID: 2291291 • Letter: U
Question
Using MATLAB software!! Must to User-Defined Fuctions Must to Conditonal statements Must to Error messages In this lectorial we will be starting the unit conversion program project which is the major assessment task for the first half of this semester In this session just create a sequential script that converts a temperature (a hardcoded numeric value) from Fahrenheit to Celsius. Test that your program outputs the correct values by using the following small set of test data to compare with your results: Sample test data Try to write another few scripts to create unit converters for the following types of units: To imperial To metric Temperatur 9 Length & Distance Lmhx2.54 Lx0.3048 Dm D x1.609344 cminch 2.54 mfeet 0.3048 kmmiles 1.609344 Mass 17 gramsounces 28.3495 kgpounds 0.4536 ?? km/h>mph 1.609344 litregallon VVx3.78544 3.78544 Area hectrare acre A-Ax2.4711 2.4711Explanation / Answer
disp('This program convert Celsius to Fahrenheit');
Celsius=input('Write a temperature in Celsius and you''ll have the result in Fahrenheit: ');
disp([ 'x = ' num2str(Celsius) ' Celcius and y = ' num2str(Celsius*1.8+32) ' Fahrenheit'])
disp('This program convert Celsius to Fahrenheit');
val = input('Type 1 for Celcius to Farenheit and Type 2 for vice versa: ');
switch val
case 1
Celsius=input('Write a temperature in Celsius and you''ll have the result in Fahrenheit: ');
disp([ 'x = ' num2str(Celsius) ' Celcius and y = ' num2str(Celsius*1.8+32) ' Fahrenheit']);
case 2
Faren=input('Write a temperature in Farenheit and you''ll have the result in Celcius: ');
disp([ 'x = ' num2str(Faren) ' Fahrenheit and y = ' num2str((Faren-32)/1.8) ' Celcius ' ]);
end
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.