Project

Curve Fit for Cubic Polynomial

The above figure shows the Curve fit for Linear polynomial.

The above figure shows the Curve fit for Cubic Polynomial.

clear all
close all
clc

%Preparing the data
cp_data=load(\'datappp\');
temperature=cp_data(:,1);
cp=cp_data(:,2);

%Curve Fit

%cp=a*T^3+b*T^2+c*T+d
co_effs=polyfit(temperature,cp,3);

predicted_cp=polyval(co_effs,temperature);

%Compare my curve fit with original data
plot(temperature,cp,\'linewidth\',3)
hold on
plot(temperature,predicted_cp,\'linewidth\',3,\'color\',\'r\')
xlabel(\'Temperature [K]\')
ylabel(\'Specific Heat [KJ/Kmol-K]\')
legend(\'Original Dataset\',\'Curve Fit\')

As clearly seen,the results for both the Curve fit(For Linear as well as Cubic) is not up to the mark.So lts consider a polynomial of degree 4, which has been shown below.

As clearly seen,after taking polynomial of 4th degree the cuve fits with the original dataset.So,this curve fit can be taken into account for the given values of Cp & temperature.

Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.