All Courses
All Courses
Courses by Software
Courses by Semester
Courses by Domain
Tool-focused Courses
Machine learning
POPULAR COURSES
Success Stories
Report Curve Fitting of Temperature vs Specific Heat data : Introduction Curve fitting is the process of constructing a curve, or mathematical functions, which possess the closest proximity to the real series of data. By curve fitting, we can mathematically construct the functional relationship between…
Aadil Shaikh
updated on 22 Jan 2020
Report
Curve Fitting of Temperature vs Specific Heat data :
Curve fitting is the process of constructing a curve, or mathematical functions, which possess the closest proximity to the real series of data. By curve fitting, we can mathematically construct the functional relationship between the observed dataset and parameter values, etc. It is highly effective in the mathematical modeling of some natural processes.
clear all
close all
clc
% preparing data
whos temperature cp
cp_data = load('data');
temperature = cp_data(:,1);
cp = cp_data(:,2);
whos temperature cp;
% curve fit
% linear polynomial - cp = a*T + b
coeffs = polyfit(temperature,cp,1);
predicted_cp_linear_poly = polyval(coeffs,temperature);
% cubic polynomial - cp = a*T^3 + b*T^2 + c*T + d
coeffs = polyfit(temperature,cp,3);
predicted_cp_cubic_poly = polyval(coeffs,temperature);
% Compare curve fit with original data
figure('name','Curve fit','numbertitle','off');
plot(temperature,cp,'linewidth',1,'color','b')
hold on
plot(temperature,predicted_cp_linear_poly,'g--')
plot(temperature,predicted_cp_cubic_poly,'r--')
title('Comparing curve fits with original data')
xlabel('temperature (K)')
ylabel('specific heat [KJ/KMOL-K]')
legend('original dataset','Linear polynomial curve fit','Cubic polynomial curve fit')
legend( 'Location', 'NorthWest' );
That the polynomial is badly conditioned and we need to add points with distinct x values and reduce the degree or polynomial . so need is to find a better solution to fit the curve and not just simply increase the polynomial order .
clear all
close all
clc
% preparing data
whos temperature cp
cp_data = load('data');
temperature = cp_data(:,1);
cp = cp_data(:,2);
% seperating the main data of temp and cp in half (1-1500)
cp01 = cp([1:1500]);
temp01 = temperature([1:1500]);
% seperating the main data of temp and cp in other half (1500-3200)
cp001 = cp([1500:3200]);
temp001 = temperature([1500:3200]);
figure('name','Curve fit','numbertitle','off')
plot(temperature,cp,'linewidth',1.5,'color','g')
hold on ;
[pred_cp2 , gof] = fit(temp01,cp01,'poly2')
plot(pred_cp2,'r--')
[pred_cp3 , gof] = fit(temp001,cp001,'poly2')
%pred_cp3 = fit(temp001,cp001,'poly2')
plot(pred_cp3,'b--')
hold off
title('Curve fit for temperature vs specific heat')
xlabel('temperature (K)')
ylabel('specific heat [KJ/KMOL-K]')
legend('original data','poly2 for 1-1500' , 'poly2 for 1500-3200 ','location','northwest')
figure
plot(temp01,cp01, 'linewidth',1.5,'color','g');
xlim( [1,3200] );
hold on
plot( pred_cp2 ,'predfun');
hold off
xlabel('temperature (K)')
ylabel('specific heat [KJ/KMOL-K]')
legend('prediction of curve ahead of 1-1500 ','curve fit','predicion', 'Location', 'NorthWest' );
figure
plot(temp001,cp001, 'linewidth',1.5,'color','g' );
xlim( [1500,5000] );
hold on
plot( pred_cp3 , 'predfun');
hold off
xlabel('temperature (K)')
ylabel('specific heat [KJ/KMOL-K]')
legend('prediction of curve ahead of 1500-3200','curve fit','predicion', 'Location', 'NorthWest' );
both are good fits .
**Comparing it with the first programs cubic polynomial & quadratic , using two poly2 equations and seperating the data we obtained 0.99 which is near accurate and very good fit and better than rsquare of poly2 equation of the first program **
with r-square and adjusted r-square as 1 and SSE as 89.
Leave a comment
Thanks for choosing to leave a comment. Please keep in mind that all the comments are moderated as per our comment policy, and your email will not be published for privacy reasons. Please leave a personal & meaningful conversation.
Other comments...
Flow over a Throttle body - Using CONVERGE CFD
I. Introduction: In this Project, A Steady & Transient state simulation is done of a Flow through an Elbow joint consisting of a throttle valve. The steady state case is solved with the Throttle valve fully open until convergence is reached. While the Transient case is ran with the throttle valve rotating i.e…
18 Sep 2020 08:29 PM IST
Literature review – RANS Derivation and analysis
Introduction: The Reynolds-averaged Navier–Stokes equations (or RANS equations) are time-averaged equations of motion for fluid flow. The idea behind the equations is Reynolds decomposition, whereby an instantaneous quantity is decomposed into its time-averaged and fluctuating quantities,…
18 Sep 2020 08:28 PM IST
C.H.T Analysis on a Graphic card using ANSYS FLUENT
I. Introduction : In this project, A steady state conjugate heat transfer analysis on a Graphic card model is done. Graphic card has become an everyday used object and a very importat part of any computer system, laptops etc. This product is mass produced daily in millions and has made computers exceptionally efficient.…
18 Sep 2020 08:23 PM IST
Aerodynamics : Flow around the Ahmed Body using ANSYS FLUENT
I. Introduction : Automotive aerodynamics comprises of the study of aerodynamics of road vehicles. Its main goals are reducing drag, minimizing noise emission, improving fuel economy, preventing undesired lift forces and minimising other causes of aerodynamic instability at high speeds. Also, in order to maintain…
18 Sep 2020 08:21 PM IST
Related Courses
0 Hours of Content
Skill-Lync offers industry relevant advanced engineering courses for engineering students by partnering with industry experts.
© 2025 Skill-Lync Inc. All Rights Reserved.