Menu

[Solved]Given One Dimension 15×1 Array Write Program Create New One Dimension 15×1 Array Using Fol Q37207960

  1. Given a ONE DIMENSION (15X1) array, write a program that willcreate a new ONE DIMENSION (15X1) array by using the followingformula (using this formula, you will not be able to calculate anew value for the first entry and the last entry – just copy thesetwo values in to the new array):

Fi = F i-1 +Fi + Fi+1

                 3

Test your program using the data onthe left. This is a technique called

SMOOTHING and is used to reduce the effect of random errorsin

experimental data.

Output the original data and thesmoothed data side by side.

NOTE: Here’s how to use the smoothing formula:

Number your data points 0 to N and let i=this number

Now,    F1 = F0 +F1 + F2 =   12.14 + 11.12 +12.65

                                     3                              3

See how each Fi is a data point? F0=12.14,F1=11.12, etc.

Similarly,   F2 = F1 +F2 + F3 =   11.12 + 12.65 +13.6

                                   3                                 3

                       Note also that you CAN NOT compute a new F0 because todo that we’d have:    F0 = F-1+ F0 + F1      We don’t have a data point before the 0 one! We also CAN

                            3               NOT compute a new F14 for a similar reason. That’s whywe’re just copying these two values to the new array (as directedabove).

NOTE: see bottom of this lab for more info on how to dothis.

Problem 1 example:   Here is an example of what yourprogram needs to do:

Assume the given values are stored in an array called OLD andthe values I will calculate will be stored in an array calledNEW.

NEW[0]=OLD[0]

NEW[14]=OLD[14]

You should be using a loop for these calculations thatfollow:

NEW[1] = (OLD[0]+OLD[1]+OLD[2])/3

NEW[2]=(OLD[1]+OLD[2]+OLD[3])/3

NEW[3]=(OLD[2]+OLD[3]+OLD[4])/3

And so on.

Problem 3 example. Assume arrays A and B look like this:

       A                         B

2     4    6                    3

8    10   12                  4

14   16   18                 5

20   22    24

Array C would be found like this:

C1 = (2*3 + 4*4 + 6*5) = 6+16+30 = 52

C2 = (8*3 + 10*4 + 12*5)

C3 = (14*3 + 16*4 + 18*5)

C4=(20*3 + 22*4 + 24*5)

Expert Answer


Answer to Given a ONE DIMENSION (15X1) array, write a program that will create a new ONE DIMENSION (15X1) array by using the foll… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *