Need help in creating a code
8 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
A town has a population census every 10 years. The results of the census are shown below. Create a spreadsheet and MATLAB Script that to return the estimation of the value of the population of the town for any year between 1900 and 2000.Make your script interactive in case there is a change in data.
9 Kommentare
Rik
am 13 Mai 2021
What syntax are you using in fprintf? Or are you still using disp? If you want a specific format, you should not be using disp.
Antworten (2)
Steven Lord
am 13 Mai 2021
Change the format you use to display the data.
year=[1900:10:2000];
pop=[550 720 1265 2287 2756 3012 4086 5220 7478 10112 14226];
n_year = 1955:3:1995;
n_pop= interp1(year, pop, n_year,'spline');
format % use the default display format
data = [n_year.', n_pop.']
format longg % use a different format
data
You could even create a table array of your data.
T = table(n_year.', n_pop.', 'VariableNames', {'Year', 'Population'})
0 Kommentare
Siehe auch
Kategorien
Mehr zu Descriptive Statistics and Visualization finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!