Write a function file that converts temperature in degrees Fahrenheit (^F) to degrees Centigrade (^C). Use input and fprintf commands to display a mix of text and numbers. Recall the conversion formulation, C = 5=9 *(F- 32).
Show older comments
i want the matlab script and command
Answers (1)
Please use the chance to search in the net or in the forum before asking a new question. You would find e.g.:
- https://www.mathworks.com/matlabcentral/answers/127409-can-someone-help-me-with-my-code-with-an-example
- The builtin function convtemp (Aerospace Toolbox)
- https://www.mathworks.com/matlabcentral/answers/37844-how-to-enter-simple-function-for-converting-fahrenheit-to-celsius
- ...
If you ask a homework question - even if it is taken from a book - please post, what you have tried so far and ask a specific question. It is not useful, if the forum solves your homework and it reduces your chances to learn Matlab. If this question occurs in a book, I'm sure that it has been mentioned also, how to write a function. If this is not the case, put the book to the dustbin, because it will not help you.
2 Comments
Tumelo Motlhanka
on 19 Apr 2022
Using MATLAB, create a table that shows the relationship between the units of temperature in degrees Celsius and Fahrenheit in the range of –50° C to 150° C. Use increments of 10° C
A table? I choose to take that literally instead of mucking around with fprintf().
How about an example which demonstrates a similar task without actually doing the assignment. You know how to create a linear vector using the colon, : operator, right?
% liquidus for medium-temperature cadmium-based solder alloys for alumimum & zinc
Alloy = {'Cd95Ag5' 'Cd82.5Zn17.5' 'Cd70Zn30' 'Cd60Zn40' 'Cd78Zn17Ag5'}.';
C = [393 265 300 316 316].';
F = round(ctof(C));
table(Alloy,C,F)
How about going the other way?
% liquidus for high-temperature lead-based solder alloys
Alloy = {'Pb100' 'Sn1Pb97.5Ag1.5' 'Sn5Pb95' 'Sn5Pb93.5Ag1.5' 'Sn5Pb92.5Ag2.5' 'Sn10Pb88Ag2'}.';
F = [621 588 597 574 536 570].';
C = round(ftoc(F));
table(Alloy,C,F)
Categories
Find more on Data Import and Analysis in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!