A co-worker of mine plotted the data (pHi1,alf) below in Excel and used the "add trendline" to fit the data. Excel returns "y = 2814.2e-3.5613x" and the fit is not very good.
I used the following Matlab code to fit the data and of course, the fit is much better.
As I am trying to explain to my co-workers the advantages of Matlab, does anyone know why Excel does such a poor job with this?
Although better can be subjective, is there something obvious that I am doing "wrong" in excel or is the answer simply "You get what you pay for"?
pHi1 = [0.063 0.113 0.22 0.286 0.373 0.437 0.53 0.547 0.709 0.938 1.72];
alf = [4620 3390 2440 1460 840 410 220 190 90 40 20];
aldis = @(dis,xx)(dis(1)*exp(-dis(2)*xx));
dis = [alf(1) 2];
disfit = nlinfit(pHi1,alf,aldis,dis)
pHfit = min(pHi1):0.1:max(pHi1);
alfit = aldis(disfit,pHfit);
figure(1)
plot(pHi1,alf,'ok','markerfacecolor','r','markersize',4)
hold on
plot(pHfit,alfit,':b')
hold off
xlabel('Initial pH')
ylabel('Dissolved Alumina by ICP (ppm)')
1 Comment
Direct link to this comment
https://in.mathworks.com/matlabcentral/answers/3342-matlab-vs-excel-matlab-seems-to-give-better-answer-to-exponential-decay-anyone-know-why#comment_87010
Direct link to this comment
https://in.mathworks.com/matlabcentral/answers/3342-matlab-vs-excel-matlab-seems-to-give-better-answer-to-exponential-decay-anyone-know-why#comment_87010
Sign in to comment.