Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a script that will read the ages vector. dat file created in the previous

ID: 3683659 • Letter: W

Question

Write a script that will read the ages vector. dat file created in the previous problem. - the script will print the number of persons in the group - the script will compute and print the "average age" The script should return something like: The file contains the ages of a group of 50 people The average age is: 18.2 years old Additionally: - the script will call a function graph_function - the function will take as an input the information contained in the ages_vector. dat - the function will round the ages - the function will create a "bar plot" showing person vs. age. - plot the average age using, for example, red + - add labels and legends describing the figure

Explanation / Answer

ages_vect= [ 1 10 30 60 90 6 5 9 10 78 13 27 57] ;
FILEDAT = 'ages_vector.mat'
save( FILEDAT , 'ages_vect' );
dbstop 5;
load( FILEDAT )
aveg = sum( ages_vect )/ length(ages_vect )
N= length(ages_vect )
fprintf(' The file contains group of %d people ', N );
fprintf(' The file contains average age of %2.2f ', aveg );

graph_function;

____second file _______________graph_function.m_____

figure ;
bar(ages_vect,'y' ) ;
hold on;
plot( 1:N, aveg ,'+r')   

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote