Project

curvefit in octave

1.As we know Curve fitting is the process of constructing a curve, or mathematical function, that has the best fit to a series of data points,the below results which i obtained where not upto the mark as it is clear that there is a bit slight deviation from the original dataset and the upper code gives a warning that the polynomial is badly conditioned.,hence by employing a cubic equation(degree 3) the curve doesnt possibly fit best to the data.

2.In order to make the curvefit perfect, We have to increase the order of polynomial for curve,instead of selecting three we can select higher orders(say 7 or 8) and do trial and error method and the most appropriate curvefit can be found out which has least error percentage.NOTE-In problems with many points, increasing the degree of the polynomial fit using polyfit does not always result in a better fit. High-order polynomials can be oscillatory between the data points.

\"curvefit\"

clear all
close all
clc

%DATA

cp_data=load(\'data\');
temperature=cp_data(:,1)
cp=cp_data(:,2)


%CP=AT^2+BT+C

co_eff=polyfit(temperature,cp,3);
predictedco_eff=polyval(co_eff,temperature);

%COMPARE MY CURVEFIT WITH ORIGINAL DATA

hold on
plot(temperature,cp);
plot(temperature,predictedco_eff);
xlabel(\'temperature [k]\');
ylabel(\'specific coefficient [kj/kmol]\');
legend(\'original dataset\',\'curvefit\');
%ERRROR CALCULATION
error=(cp - predictedco_eff).*100./cp;
fprintf(\'Maximum error percentage =\');
disp(max(error));


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.