Question

I need help on calculating a current overall average for this data in MatLab. I need...

I need help on calculating a current overall average for this data in MatLab. I need to make another vector for the data where each position is a current average. I've looked around online to try and get an idea of what to do and I saw the things about there being a moving average function or using filter. But we haven't talked about those in my class so I can't use them. I think a for loop could do it but I can't figure it out. The data is 97, 80, 79, 64, 71, 77, 95, 81, 73, 84, 86, 96, 83, 69, 64, 66, 59, 72, 67, 65, 65, 64, 59, 68, 75, 62, 77, 58, 66, 56, 53, 62. The output for the home score should be 97, 88. 85.3, 80.0, 78.2, 80.4, 80.5, 79.7, 80.1, 80.6, 81.9, 82.0, 81.1, 79.9, 79.1, 77.9, 77.6, 77.0, 76.4, 75.8, 75.0, 74.7, 74.8, 74.2, 74.3, 73.7, 73.5, 72.9, 72.2, 71.0.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

code:

numbers=0;

result=0;

while 1

n=str2double(input('Enter an integer: ', 's'));

result=result*numbers+n;

numbers=numbers+1;

result=result/numbers;

fprintf('Current average is: %f\n', result);

end

For indendation:

Sample i/o:

Explanation:

Average is (sum of all numbers)/count. Hence in each iteration find the previous sum by multiplying average*count. Now add value read from console to previous sum and increment the count and print the average.

Add a comment
Know the answer?
Add Answer to:
I need help on calculating a current overall average for this data in MatLab. I need...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • i need help with this error and what i need to fix exactly . File Edit...

    i need help with this error and what i need to fix exactly . File Edit View Build Project Settings Tools Window Help MEDIKUAR 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 private static double[] readDataPrompile() throws IOException { double[] rainfallDataFromFile - new double[12]; 7/File file - new File("/Users/destinytaylor/DTaylor Lab 4/rainfallData.txt"); //kept file in same directo File file = new File("rainfalldata.txt"); BufferedReader br new BufferedReader(new FileReader(file)); iedene String data; int i...

  • on ма m Question Help Refer to the accompanying data set and construct a 90% confidence...

    on ма m Question Help Refer to the accompanying data set and construct a 90% confidence interval estimate of the mean pulse rate of adult females; then do the same for adult males. Compare the results. Click the icon to view the pulse rates for adult females and adult males Construct a 90% confidence interval of the mean pulse rate for adult females. bpmu<bpm (Round to one decimal place as needed.) Construct a 90% confidence interval of the mean pulse...

  • Here is a data set (n = 117) that has been sorted. 56.8 69.8 71.2 73.7...

    Here is a data set (n = 117) that has been sorted. 56.8 69.8 71.2 73.7 75.5 77. 4 78.7 80.3 81. 8 84. 5 87 88.6 92.4 59.9 70.4 72.2 74 75.6 77.5 78.7 80.5 8 2 85 87.1 88.6 92.7 61.2 70.4 72.3 74.1 75.9 77.7 78.7 80.8 82.2 85.3 87.6 88.9 92.8 62.2 68.4 70.5 70.6 72.4 72.5 74.2 74.3 76.1 76.2 77.8 77. 8 78.9 79.1 | 81 | 81.1 82.2 82.2 86.1 86.5 87.8 87.9...

  • For the Florida data file (below) giving countywide data in Florida for several variables, a moderate...

    For the Florida data file (below) giving countywide data in Florida for several variables, a moderate positive correlation (r = 0.47) exists between crime rate and percent who are high school graduates. The percentage living in urban areas is also strongly correlated with crime rate (r = 0.68) and with high school graduation rate (r = 0.79). a. Explain why the association between crime rate and high school graduation rate could disappear, or even change direction, when we control for...

  • 2 62.8 MEAN = 3 71.9 MEDIAN = 4 69.6 MODE= 5 74.1 RANGE = 6 66.6 MIN. = 7 76.5 MAX.= 8 66.4 STDEV. = 9 73.1 MY HEIGHT =67.00 10 71.6 Z SCORE FOR MY HEIGHT = 11 69.3 12 64.0 13...

    2 62.8 MEAN = 3 71.9 MEDIAN = 4 69.6 MODE= 5 74.1 RANGE = 6 66.6 MIN. = 7 76.5 MAX.= 8 66.4 STDEV. = 9 73.1 MY HEIGHT =67.00 10 71.6 Z SCORE FOR MY HEIGHT = 11 69.3 12 64.0 13 70.9 14 62.2 15 63.3 16 67.7 17 65.2 18 64.2 19 69.4 20 71.7 21 64.6 22 69.0 23 71.3 24 69.1 25 71.6 26 75.9 27 66.2 28 67.4 29 64.6 30 69.6 31...

  • Hello, I need some help interpreting statistical data. There is an Anova analysis for the moth...

    Hello, I need some help interpreting statistical data. There is an Anova analysis for the moth data as well. Type of Lure (chemical attractant) Spruce Moth Traps - Response: number of spruce moths found in trap after 48 hours at. Scen 28 19 32 15 13 39 12 42 25 21 ar 35 32 29 16 18 20 37 40 18 28 36 35 39 Factor 1: Location of trap in tree (top branches, middle branches, lower branches, ground) Factor...

  • Use C++ (2D Array) Write a program which: 1. Assigns data given below into the 2D...

    Use C++ (2D Array) Write a program which: 1. Assigns data given below into the 2D array of integers which is 10x10. 2. Prints out the contents of the 2D array after assigning the data to make sure correct data was assigned. 3. Figures out and prints out the square root of the sum of ALL the elements in the 2D array. 4. Figures out and prints out the average of ALL THE ELEMENTS in the 2D array. 5. Figures...

  • data: (if needed) Race   Position   Oral exam results   Written exam results   Combined results B   Lieutenant   45.83   46   45.932 B   Lieutenant   52.92   49   50.568 B   Captain   54.76   49   51....

    data: (if needed) Race   Position   Oral exam results   Written exam results   Combined results B   Lieutenant   45.83   46   45.932 B   Lieutenant   52.92   49   50.568 B   Captain   54.76   49   51.304 H   Lieutenant   48.33   58   54.132 B   Lieutenant   52.08   56   54.432 H   Lieutenant   40.83   64   54.732 B   Captain   60   53   55.8 W   Captain   53.81   58   56.324 B   Lieutenant   58.75   55   56.5 W   Lieutenant   54.58   58   56.632 B   Lieutenant   55.83   58   57.132 W   Lieutenant   45.42   65   57.168 H   Lieutenant   44.17   66   57.268 H   Captain  ...

  • Data: (If needed) Race   Position   Oral exam results   Written exam results   Combined results B   Lieutenant 45.83   46   45.932 B   Lieutenant 52.92   49   50.568 B   Captain 54.76   49   51.304 H ...

    Data: (If needed) Race   Position   Oral exam results   Written exam results   Combined results B   Lieutenant 45.83   46   45.932 B   Lieutenant 52.92   49   50.568 B   Captain 54.76   49   51.304 H   Lieutenant 48.33   58   54.132 B   Lieutenant 52.08   56   54.432 H   Lieutenant 40.83   64   54.732 B   Captain 60   53   55.8 W   Captain 53.81   58   56.324 B   Lieutenant 58.75   55   56.5 W   Lieutenant   54.58   58   56.632 B   Lieutenant 55.83   58   57.132 W   Lieutenant 45.42   65   57.168 H   Lieutenant 44.17   66   57.268 H   Captain...

  • The average for the data is 21.52 i don’t know if that helps or not eBook...

    The average for the data is 21.52 i don’t know if that helps or not eBook Videe Data were collected on the amount spent by 64 customers for lunch at a major Houston restaurant. These data are contained in the fle named Houston. Based upon past studies the population standard deviation is known with σ-$13. Click on the datafile logo to reference the data. DATA血 Round your answers to two decimal places. Use the critical value with three decimal places....

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT