Question

In: Mechanical Engineering

(Using Matlab)We are given data about a charity organization in table 1 Days 10 20 30...

(Using Matlab)We are given data about a charity organization in table 1 Days 10 20 30 40 50 60 70 80 90 100 Donation 23 45 60 82 111 140 167 198 200 220 Table 1: Donation collection by the charity organization Assume that x corresponds to the independent variable. Compute linear, quadratic and cubic fit for the data using regression techniques and plot them on three different graphs, all on the same figure. Use an appropriate small interval to create your plots. Mark the original data with green circles. Give appropriate titles and labels for the graph. Explain in few sentences which model best represents the data and why? Now, use the best model to find the value of the donation collection for 25th day. Print this value.

Solutions

Expert Solution

MATLAB CODE

clc
clear all
d=[10 20 30 40 50 60 70 80 90 100];
D=[23 45 60 82 111 140 167 198 200 220];
a=polyfit(d,D,1); % Linear fit
b=polyfit(d,D,2); %Quadratic fit
c=polyfit(d,D,3); %Cubic fit
D1=polyval(a,d);
D2=polyval(b,d);
D3=polyval(c,d);

subplot(3,1,1)
plot(d,D1,'k-o')
hold on
plot(d,D,'go')
title('Linear fit')
xlabel('Days')
ylabel('Donation')
legend('Fitted data','Origional data')

subplot(3,1,2)
plot(d,D2,'k-o')
hold on
plot(d,D,'go')
title('Quadratic fit')
xlabel('Days')
ylabel('Donation')
legend('Fitted data','Origional data')

subplot(3,1,3)
plot(d,D3,'k-o')
hold on
plot(d,D,'go')
title('Cubic fit')
xlabel('Days')
ylabel('Donation')
legend('Fitted data','Origional data')

donation25th=polyval(c,25) %Donation at 25th day using cubic fit

OUTPUT

donation25th =

49.1270

Remark - From the cubic fitted curve it is clear that all the fitted data coincing with origional data hence cubic curve is best for given data


Related Solutions

USING MATLAB: Using the data from table below fit a fourth-order polynomial to the data, but...
USING MATLAB: Using the data from table below fit a fourth-order polynomial to the data, but use a label for the year starting at 1 instead of 1872. Plot the data and the fourth-order polynomial estimate you found, with appropriate labels. What values of coefficients did your program find? What is the LMS loss function value for your model on the data? Year Built SalePrice 1885 122500 1890 240000 1900 150000 1910 125500 1912 159900 1915 149500 1920 100000 1921...
Given the data {20, 20, 30, 30, 40, 40, 50, 50, 60, 60}, calculate 1. Gini...
Given the data {20, 20, 30, 30, 40, 40, 50, 50, 60, 60}, calculate 1. Gini coefficient using the quintile distribution. 2. Draw the Lorenz curve with proper labels.
Given the following table: Probability X Y 20% 15% 30% 60% 25% 18% 20% 30% 20%...
Given the following table: Probability X Y 20% 15% 30% 60% 25% 18% 20% 30% 20% Calculate a) the covariance of X and Y, and b) the correlation coefficient. Select one: a. a) -20.64% b) -0.90 b. a) -20.18% b) -0.88 c. a) -17.89% b) -0.78 d. a) -19.20% b) -0.84 e. a) -18.35% b)-0.80
Table 1 Price Quantity Demanded Quantity Supplied $10 10 60 $8 20 45 $6 30 30...
Table 1 Price Quantity Demanded Quantity Supplied $10 10 60 $8 20 45 $6 30 30 $4 40 15 $2 50 0 1   Refer to Table 1. The equilibrium price and quantity, respectively, are a. $2 and 50. b. $6 and 30. c. $6 and 60. d. $12 and 30. 2. .   Refer to Table 1. If the price were $8, a a. shortage of 20 units would exist and price would tend to rise. b. surplus of 25 units...
Given the data set below, use it to answer the following questions: 10, 20, 30, 40,...
Given the data set below, use it to answer the following questions: 10, 20, 30, 40, 50 a. Find the standard deviation b. Add 5 to each data set value and find the standard deviation. c. Subtract 5 from each value and find the standard deviation. d. Multiply by 5 on each value and find the standard deviation. e. Divide by 5 on each value and find the standard deviation. f. Generalize the results in parts a-e.
Question 1 For the dataset: 20, 20, 10, 10, 40, 50, 20, 30, 10, 20, 50,...
Question 1 For the dataset: 20, 20, 10, 10, 40, 50, 20, 30, 10, 20, 50, 60, 20, 30, 50, 20, 30, 40, 30, 30, 30, 50, 40 calculate the max, min, mode, median and mean.(20%) Draw a boxplot with inner and outer fence For the data in part (i), if the value 60 was replaced by 2000, what would you call this value in the dataset? What could be the explanation for such a value? How can you through...
Calculate F Test for given 10, 20, 30, 40, 50 and 5,10,15, 20, 25. For 10,...
Calculate F Test for given 10, 20, 30, 40, 50 and 5,10,15, 20, 25. For 10, 20, 30, 40, 50:
[Point: 10] The instance of a list ADT using array is L = (10, 20, 30,...
[Point: 10] The instance of a list ADT using array is L = (10, 20, 30, 40, 50, 60). Find the output of following code segment or what is returned by each statement. remove(30);          find(50):                insert(7, 3):           findKth(4)             [Point: 5] The complexity of remove operation from a LIST ADT using array implementation is O(N). Explain why? [Point: 10] Show that the running time for the following segment of code is O(N3) without using the rule for loop. Make sure to...
Please answer it with explanation A      Table 1 Output (units per day) 0 10 20 30 Total...
Please answer it with explanation A      Table 1 Output (units per day) 0 10 20 30 Total cost (dollars per day) $40 $54 $62 $80 For the output levels in Table 1, the minimum of the average variable cost curve occurs at a production rate of                 A)    Zero units per day.                  B)    10 units per day.          C)    20 units per day.          D)    30 units per day. B      Refer to Table 2 below Table 2 Units of Labor Units of Output Marginal Product 0 0 1 30...
Data Structures: Hashing Exercise: 1. a) Given an empty “separate chaining hash table” of size 10,...
Data Structures: Hashing Exercise: 1. a) Given an empty “separate chaining hash table” of size 10, with hash function                        Location = Number modulus 10 Show the hash table after inserting the following numbers: 21, 18, 27 , 31 , 48, 51 , 37, 98, 17 b) What table size would be better? 11? 12? 20? 2. We want to hash name strings into a chaining hash table of size 10, how would you divide the alphabet into 10 groups?...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT