%This function creates a plot of Density vs. Temperature as well as a
%table containing the data vectors
function [Density, TD] = WaterDensity
%to run this program, you simply need to enter into the Command Window
%WaterDensity;
%If you would like to return the Density vector and Temperature vector
%you would want to enter
%[D,T]=WaterDensity;
%into the Command Window.  You can cut and paste the above commands
Density = [999.841, 999.847, 999.854, 999.86, 999.866, 999.872, 999.878,...
    999.884, 999.889,999.895, 999.9, 999.905, 999.909, 999.914, 999.918,... 
    999.923, 999.927, 999.93, 999.934, 999.938, 999.941, 999.944,...
    999.947, 999.95, 999.953, 999.955, 999.958, 999.96, 999.962, 999.964,...
    999.965, 999.967, 999.968, 999.969, 999.97, 999.971, 999.972, 999.972,...
    999.973, 999.973, 999.973, 999.973, 999.973, 999.972, 999.972, 999.972,... 
    999.97, 999.969, 999.968, 999.966, 999.965, 999.963, 999.961, 999.959,... 
    999.957, 999.955, 999.952, 999.95, 999.947, 999.944, 999.941, 999.938,... 
    999.935, 999.931, 999.927, 999.924, 999.92, 999.916, 999.911, 999.907,... 
    999.902, 999.898, 999.893, 999.888, 999.883, 999.877, 999.872, 999.866,... 
    999.861, 999.855, 999.849, 999.843, 999.837, 999.83, 999.824, 999.817,... 
    999.81, 999.803, 999.796, 999.789, 999.781, 999.774, 999.766, 999.758,... 
    999.751, 999.742, 999.734, 999.726, 999.717, 999.709, 999.7];
TD = linspace(0,10,101);%temperature vector
plot(TD,Density)
xlabel('Temperature (Celsius)'),ylabel('Density (kg/m^3)')
table(TD',Density','VariableNames',{'Temperature','Density'}) 
