Q. 1. The data set below represents an exponential function.: (a) Compute the va
ID: 3545015 • Letter: Q
Question
Q. 1. The data set below represents an exponential function.:
(a) Compute the values of m and b hence the exponential relationship y=bem x.
(b) Compute the coefficient of correlation r2 for this exponential fit.
Hint: Compute the individual terms according the exponential fit relationships given below. Add columns to the table above to help with the house keeping of terms.
m= [ n(?xi In(yi))-(?xi)(? In(yi)) ] / [n(?xi2 )-(?xi)2 ]
In(b)= [? In(yi)-m( ?xi)] / n
b= eIn(b)
r2 = [ [n(?xi In(yi))-(?xi)(?In(yi))] / [(n(?xi2)-(?xi)2)1/2] [(n(?In(yi)2)-(?In(yi))2)1/2]]2
Explanation / Answer
clc clear x = [0,1,2,3,4,5,6,7]; y = [2.3,1.1,0.55,0.27,0.13,0.06,0.03,0.01]; n = length(x);m = (n*sum(x.*log(y))-sum(x)*sum(log(y)))/(n*sum(x.*x)-sum(x)^2); ln_b = (sum(log(y))-m*sum(x))/n; b = exp(ln_b); r2=((n*sum(x.*log(y))-sum(x)*sum(log(y)))/(sqrt(n*sum(x.*x)-sum(x)^2)... *sqrt(n*sum(log(y).*log(y))-sum(log(y))^2)))^2;
a = sprintf('m = %1.4f b = %1.4f r2 = %1.4f',m,b,r2); disp(a)
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.