a new title
*********** Remarks of the Evaluator ************
Good Job
- You have not evaluated the goodness of fit
Also, you have not estimated errors, in curve fitting, the error is estimated in two ways
- The sum of squares due to error (SSE)
- Root mean squared error (RMSE)
Also, blindly increasing the degree of the polynomial will not result in a better fit in all cases. The best way to proceed then is to divide the data points in subregions and curve fit for each region seperately.
NOTE : Also, try exploring on the fit( ) command and curve fitting toolbox in matlab if interested, this provides you with a plethora of options in optimizing a fit without using multiple equations and also calculates the fit characteristics for you !!!
SUGGESTION (GENERAL):
The other thing that you can do is to attach the code and images in
projects.skill-lync.com and paste the link over here.
If you have any doubts please ask us on WHATSAPP or raise a ticket on FRESHDESK or even call us to clarify all your doubts.
Please don't submit incomplete work as these challenges are made with an intuition of improving your understanding of the topic.
So, attempt all challenges sincerely.
Thank you.
*****************************************
In this challenge we code to fit a linear and cubic polynomial for the given cp data
Theory
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.
Problem statement
we need check fit for both linear and cubic polynomial for the given cp data and plot both the curves and see which fits the best and tell what needs to be done to make the curve fit perfect.
Program to check the fit
clear allclose allclccp_data = load('data');temperature = cp_data(:,1);cp = cp_data(:,2);co_effs = polyfit(temperature,cp,1);predicted_cp = polyval(co_effs,temperature);figure(1)plot(temperature,cp,'linewidth',3)hold on plot(temperature,predicted_cp,'linewidth',3)xlabel('temperature [k]')ylabel('Specific heat [kj/kmol-k)')title('linear')legend('original dataset','curve fit')co_effs = polyfit(temperature,cp,3);predicted_cp = polyval(co_effs,temperature);figure(2)plot(temperature,cp,'linewidth',3)hold on plot(temperature,predicted_cp,'linewidth',3)xlabel('temperature [k]')ylabel('Specific heat [kj/kmol-k)')title('cubic')legend('original dataset','curve fit')Results
plot for linear
plot for cubic
from the above plots we can clear say that cubic curve clearly fits better compared to linear
But if we increase the order 4,5,6... we might get a much better fit than cubic and to know which order of polynomial fits the best we have to error check by RMSE, lower the RMSE the better the curve fits.