Skip to content

Instantly share code, notes, and snippets.

@MichaelTr7
Last active April 8, 2021 18:01
Show Gist options
  • Save MichaelTr7/12ba1c4d10afe42a228537c603855563 to your computer and use it in GitHub Desktop.
Save MichaelTr7/12ba1c4d10afe42a228537c603855563 to your computer and use it in GitHub Desktop.
A MATLAB script for curve fitting a plot of data-points.
%Curve Fitting and Publishing MATLAB Code as a PDF%
Random_Data_Y = [0 0.141 0.205 0.271 0.371 0.437 0.444];
Random_Data_X = [2.42 104 112 119 126 131 131];
%Preparing data to be curved fitted%
[Random_Data_X, Random_Data_Y] = prepareCurveData(Random_Data_X, Random_Data_Y);
%Applying type of curve fitting%
f = fit(Random_Data_X, Random_Data_Y,'smoothingspline');
%f will now act as a parameter to suggest plot type%
plot(f,Random_Data_X, Random_Data_Y);
@MichaelTr7
Copy link
Author

Output Results

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment