I need help writing a Matlab script file that creates a temperature conversion chart for conversion from Fahrenheit to Celsius
27 views (last 30 days)
So, I have a homework assignment. I've done most of the coding and I have the result right. But I don't know how to print out the chart to the screen or save it to a file. I can't watch the lesson because my internet isn't good enough so I'm kind of lost.
The prompt is:
Write a Matlab script file that creates a temperature conversion chart for conversion from Fahrenheit to Celsius. The script should prompt the user to input the minimum and maximum temperatures that’ll determine the range of temperatures for the chart in Fahrenheit as well as the number of rows for the char. The script should then print the chart to the standard output and to a file “temperature_conversion.txt”.
And here's what I have so far
prompt = 'Input the minimum degree in Farenheit to convert to Celsius: ';
Fmin = input(prompt);
prompt = '\nInput the maximum degree in Farenheit to convert to Celsius: ';
Fmax = input(prompt);
prompt = 'How many outputs do you want between these two temperatures? ';
rows = input(prompt);
Frange = linspace(Fmin, Fmax, rows);
I tried something like
fprintf('%d degrees C\n', C);
but it prints out the numbers like '6.349206e-01' and doesn't look like a chart. Any advice on how to do the last two requests?
Rashed Mohammed on 26 May 2020
You can go through https://www.mathworks.com/help/matlab/2-and-3d-plots.html and plot a chart as required from the data you have. For saving the chart to a file you can use the saveas function.
Hope this helps!