Consider the function c A1 expbit c1 A2 expb2 t c for t
     Consider the function c = A_1 exp(-bit + c_1) + A_2 exp(-b_2 t + c:), for t ranging from 0 to 60 by steps of .1, A_1 = 50, b_1 =.1, c_1 = 0, A_2 = 100, b_2 =.01, c_2 = -1. Write a Matlab code that simulates and plots the curve (c vs. t). Add Gaussian noise to c with sigma = 2 creating d, and plot the data points d with the curve. Calculate the following:  S = sigma_i = 1^n (d_i - c_i)^2  Note that i\'s are the indices of the arrays. Repeat this m=1000 times or more (without the graphs) and save the values of S into an array. Plot the histogram for S. Comment on the distribution of S. 
  
  Solution
clear;
 a1=50;
 b1=0.1;
 c1=0;
 a2=100;
 b2=0.01;
 c2=-1;
t1=0:0.1:60;
c1=a1*exp(-b1.*t1+c1)+a2*exp(-b2.*t1+c2); %Calculate c
 d1=awgn(c1,2); %Add gaussian noise
plot(t1,c1,t1,d1);
for m=1:1:1000 %Iterate 1000 times
     d1=awgn(c1,2);
     s1(m)=sum((d1-c1).^2);
 end
histogram(s1) %Plot histogram
From the histogram it is seen, the values of S concentrate around 380. It is a normal distribution bell shaped curve.

