Project

Curve fitting for Heat Capacity

%--------------------------------------------------------------------------
%% Programe for Polynomial Curve Fitting
%--------------------------------------------------------------------------

close all;
clear all;
clc;

%--------------------------------------------------------------------------
%% Importing of the data from the file to the required variables 
%--------------------------------------------------------------------------
Data= load(\'data\');
Temperature=Data(:,1);
Cp=Data(:,2);

%--------------------------------------------------------------------------
%% Plotting of the actual data
%--------------------------------------------------------------------------
plot(Temperature,Cp,\'Linewidth\',2);
%--------------------------------------------------------------------------
%% Defining the poltfit to get the coefficients
%--------------------------------------------------------------------------

Coeffie= polyfit(Temperature,Cp,3);
New_Cp=polyval(Coeffie,Temperature);
hold on 
plot(Temperature,New_Cp,\'Linewidth\',2)
xlabel(\'Temperature\')
ylabel(\'Specific Heat\')
legend(\'Original Data\',\'Fit Data\')

error=Cp-New_Cp; %Error calculation
Max_error=max(error)
Min_error=min(error)

\"\"

The maximum and minimum error in the order of 9.6525 and -13.4401. So, which is not satisfactory and the fit can be improved.

The fit can be improved reduced by centering and scaling

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.