Curve Fitting
https://drive.google.com/open?id=1KAGakjHuXZGDvV0WVj6Ipxu6PxXfKAMV
clear all
close all
clc
% Preparing the data
cp_data=load(\'data\');
temperature=cp_data(:,1);
cp=cp_data(:,2);
%Plotting
% Curve fit
% cp= aT^2 + b*T + c
co_effs= polyfit(temperature,cp,4);
predicted_cp= polyval(co_effs , temperature);
% compare curve fit with original data
plot(temperature,cp,\'-.\',\'linewidth\',2);
hold on
plot(temperature,predicted_cp,\'linewidth\',3,\'color\',\'r\');
xlabel(\'Temperature [K]\');
ylabel(\'Specific Heat [KJ/Kmol-K]\');
legend(\'Original data set\',\'Curve fit\')
.......................4Th Degree Curve............................
..........................Cubic Curve........................................
................Quadratic Curve fitting.....................
...................... Linear curve fit...................
From the above graphs, it is pretty clear that we have to take the curve to the 4th order to make it perfect.