I am working on some problems with curve fitting ect, and need to find the derivative of a cubic fit of 50 points. The questions asks to find the growth rate of bacteria given data. My current code is
time = [1,2,4,5,7,9];
bacteria = [2000,4500,7500,15000,31000,64000];
rcubic = polyfit(time,bacteria,3);
newTime = linspace(1,7,50);
vrcubic = polyval(rcubic,newTime);
growthRate = [diff(vrcubic)./diff(newTime)];
derivative = diff(vrcubic)
i am wondering whether growthRate or derivative is correct for this problem, or if they are both wrong. as they given markedly different values. Also as the length of the vector is shortened.
Cheers