Here is the code that I have:
clear all; close allm = xlsread('1 MgO.xlsx','Sheet1','B1:J18');temp = m(:,6);MgO = m(:,3);plot(temp, MgO,'*')xlabel('Temperature (K)'); ylabel('Shear Modulus (GPa)'); title('MgO')hold on% Line of best fit
p = polyfit(temp,MgO,3);y = polyval(p,temp);plot(temp,y,'-')SSE=sum((MgO-y).^2); SST=sum((MgO-mean(MgO)).^2); Rsquared=1-SSE/SST;text(100,100,sprintf('y = %.3x^3 + %.3fx^2 + %.3fx + %.3f, R^2 = %.3f',p(1),p(2),p(3),p(4), Rsquared))
I'm trying to figure out how to get the second derivative and find at what temperature it equals 0. temp is my xaxis and MgO is my yaxis. I tried using the diff command but it didn't really work. Could someone help please?
Best Answer