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

The assignment is to write a computer program using MATLAB to analyze normally d

ID: 3764387 • Letter: T

Question

The assignment is to write a computer program using MATLAB to analyze normally distributed data and to output values of probabilities corresponding to inputted x or z values, or to output x or z values corresponding to inputted probabilities. This application should allow the user to load data and interactively choose plots of the data to make the judgment call as to whether or not the data is normally distributed. If, in the user’s judgment, the data is normally distributed, the user is allowed to perform z-table calculations resulting in the output of either probabilities or of x or z intervals.

The following list represents the general features of the program:

Input a data file consisting of a single column of an unknown number of data elements.

Open a file for output. Filename should be chosen by user. o Write the data file name to the output file along with date, user name, etc.

o Calculate and write to the output file all the descriptive statistics listed below in the following format:

Mean = XXX.YY

Median = XXX.YY

Mode = XXX.YY

Var = XXX.YY

Stdev = XXX.YY (using n-1) or (using n)

Min = XXX.YY

Max = XXX.YY

Count = XXXXX

o Please note that the equal signs and decimal points are aligned vertically.

o Please note that since Count is an integer, it has no decimal point.

o Note that if Count > 30, use the population standard deviation and put an extra message in the output. For Count <= 30, use sample standard deviation and put an extra message in the output.

Menu (You may choose a different menu scheme.)

o Get user name

o Load file

o Change output filename

o Plot histogram

o Plot histfit

o Plot probability plots

o Find probability given x or z o Find x or z given probability

Please include everything needed pls.

Explanation / Answer

Answer:

%matlab code

%print the menu

fprintf('The following are the choices');

fprintf('1. select username');

fprintf('2. load file');

fprintf('3. change output filename');

fprintf('4. plot histogram');

fprintf('5. plot histfit');

fprintf('6. plot probability plots');

fprintf('7. find the probability given x or z');

select=input('select your choice');

username=' ';

fileName=' ';

inputA=[];

varIn=0;

meanIn=0;

medIn=0;

std1=0;

modeIn=0;

count=0;

%get username

if select==1

     username=input('Enter the user name','s');

%load file

elseif select==2

     fID=fopen('input.txt','r');

     newInput=fscanf(fID,'%f');

     inputA=[inputA newInput];

     fclose(fID);

%read output filename and write the mean,mode,variance,standarddeviation,count,ma,min

elseif select==3

     filename=input('Enter the output filename','s');

     fID2=fopen(filename,'wt');

     meanIn=mean(inputA);

     varIn=var(inputA);

     medIn=median(inputA);

     modeIn=mode(inputA);

     count=length(inputA);

     maxIn=max(inputA);

     minIn=min(inputA);

     if count<=30

          std1=stddev(inputA);

     elseif count>30

          std1= sqrt(sum((inputA-mean)*(inputA-mean)/length(n)));

     end

     fprintf(fID2,'%s',username);

     fprintf(fID2,'%f',meanIn);

     fprintf(fID2,'%f',modeIn);

     fprintf(fID2,'%f',varIn);

     fprintf(fID2,'%f',medIn);

     fprintf(fID2,'%d',count);

     fprintf(fID2,'%f',std1);

%plot histogram

elseif select==4

     hist(inputA);

%plot histfit

elseif select==5

     histfit(inputA);

%plot z score

elseif select==6

     z=zscore(inputA);

     plot(z)

%find z score

elseif select==7

     getIn=input('enter x value');

     zscr=(getIn-meanIn)/std1;

     fprintf('Z score: %f',zscr);

else

     fprintf('invalid selction');

end

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