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).

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.:
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

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)
ans = 5×3 table
Alloy C F ________________ ___ ___ {'Cd95Ag5' } 393 739 {'Cd82.5Zn17.5'} 265 509 {'Cd70Zn30' } 300 572 {'Cd60Zn40' } 316 601 {'Cd78Zn17Ag5' } 316 601
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)
ans = 6×3 table
Alloy C F __________________ ___ ___ {'Pb100' } 327 621 {'Sn1Pb97.5Ag1.5'} 309 588 {'Sn5Pb95' } 314 597 {'Sn5Pb93.5Ag1.5'} 301 574 {'Sn5Pb92.5Ag2.5'} 280 536 {'Sn10Pb88Ag2' } 299 570

Sign in to comment.

Categories

Find more on Data Import and Analysis in Help Center and File Exchange

Asked:

on 13 Nov 2017

Commented:

DGM
on 6 Feb 2023

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!