Created
October 30, 2023 12:41
-
-
Save cinnamondev/2195e1e7f2a491253688ecd45cdfee4f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function output = plotPolynomialFit(ds_x, ds_y, N,confidence, resolution) | |
[output, error] = polyfit(ds_x,ds_y,N); | |
if confidence | |
range = linspace(0, max(ds_x), resolution) | |
[outputline, delta] = polyconf(output, range, error, 'predopt', 'curve') | |
plot(range, outputline, "-"); | |
hold on | |
plot(range,outputline+delta,"r--",range,outputline-delta,"r--"); | |
hold off | |
else | |
[outputline, delta] = polyval(output,ds_x, s1_e); | |
plot(range,outputline,"--"); | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment