Need help with my code I have I don't know how to label the columns on it and change "table" to another function like disp(), display(), and fprintf() instead.

조회 수: 1 (최근 30일)
C=-50:10:150;
F=(C*(9/5))+32;
fprintf('HW #6 - Evan Melanson \n\n');
fprintf('Problem 1 \n\n');
oC=C';
oF=F';
fprintf('degree Celsius and Fahrenheit table\n');
disp(t(round(oC,3),round(oF,3)))
%this is what i have so far whatever you can do to make it work with the
%titles on the columns and ether disp(), display(), and fprintf() instead
%works for me

답변 (1개)

Yusuf Suer Erdem
Yusuf Suer Erdem 2021년 11월 18일
C=-50:10:150;
F=(C*(9/5))+32;
fprintf('HW #6 - Evan Melanson \n\n');
fprintf('Problem 1 \n\n');
oC=C';
oF=F';
fprintf('degree Celsius and Fahrenheit table\n');
oC=round(oC,3);
oF=round(oF,3);
plot(oC,oF)
xlabel('Celsius')
ylabel('Fahrenheit')
I changed your codes into this format, i hope it is what you wanted. I did not perceive the part "change table to another function". Good luck!
  댓글 수: 1
evan melanson
evan melanson 2021년 11월 18일
Thank you for your work but i am looking to make a table and not a graph. sorry! this is my instrustions bellow
(30 pts) Table Only. Work problem 15.4 in the textbook. Additional requirements:
Write a MATLAB program (script or .m file).
Begin with the block of comments as described above. Add other comments throughout the program.
Use a range variable to assign the values in degrees C to a vector.
Use a formula on the vector above to create another vector in degrees F.
Combine the transpose of the two vectors to create a new vector (table).
Display the problem number and your name before displaying the table.
Display the table and include a table heading (with units).
No special formatting is required for this problem.
Print the script and the output table.
Extra credit: Use fprintf to use 3 digits after the decimal point for the values in degrees C and to use 2
digits after the decimal point for the values in degrees F.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Structures에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by