File:Curve fitting.svg
From Wikipedia, the free encyclopedia
Jump to navigation
Jump to search
Size of this PNG preview of this SVG file: 512 × 384 pixels. Other resolutions: 320 × 240 pixels | 640 × 480 pixels | 1,024 × 768 pixels | 1,280 × 960 pixels | 2,560 × 1,920 pixels.
Original file (SVG file, nominally 512 × 384 pixels, file size: 23 KB)
This is a file from the Wikimedia Commons. Information from its description page there is shown below.
Commons is a freely licensed media file repository. You can help.
Commons is a freely licensed media file repository. You can help.
Summary
| DescriptionCurve fitting.svg |
English: This graph shows a series of points (generated by a Sin function) approximated by polinomial curves (red curve is linear, green is quadratic, orange is cubic and blue is 4th degree).
Italiano: Il grafo mostra una serie di punti (generati dalla funzione seno) approssimati da curve polinomiali (in rosso di primo grado, verde di secondo, arancione di terzo e verde di quarto. |
| Date | |
| Source | Own work |
| Author | Krishnavedala |
| Other versions |
|
| SVG development InfoField |
GNU Octave source code
|
|---|
x = 1:1.5:100;
y = sin(x/10);
p1 = polyfit(x,y,1);
p2 = polyfit(x,y,2);
p4 = polyfit(x,y,4);
p3 = polyfit(x,y,3);
figure;
plot(x,y,'k.'); hold all
plot(x,polyval(p1,x),'r');
plot(x,polyval(p2,x),'g');
plot(x,polyval(p3,x),'color',[1 .5 0]);
plot(x,polyval(p4,x),'b');
grid on
set (gca,'xaxislocation','zero')
set (gca,'yaxislocation','zero')
box off
print('Curve fitting.svg')
|
Python source Code
|
|---|
|
Created using python with numpy and matplotlib toolboxes. from numpy import *
from matplotlib.pyplot import *
from mpl_toolkits.axes_grid.axislines import SubplotZero
x = linspace(0,100,75)
y = sin(2.*pi*x/60.+.4)
y1 = poly1d(polyfit(x,y,1)) # linear
y2 = poly1d(polyfit(x,y,2)) # quadratic
y3 = poly1d(polyfit(x,y,3)) # cubic
y4 = poly1d(polyfit(x,y,4)) # 4th degree
fig = figure(figsize=(6,4))
ax = SubplotZero(fig,111)
fig.add_subplot(ax)
ax.grid(True)
ax.plot(x,y1(x),'r',label=u'linear')
ax.plot(x,y2(x),'g',label=u'quadratic')
ax.plot(x,y3(x),'orange',label=u'cubic')
ax.plot(x,y4(x),'b',label=u'$4^{th}$ order')
ax.plot(x,y,'k.',label=u'data')
ax.set_xlabel(u'x')
ax.set_ylabel(u'y')
ax.minorticks_on()
ax.legend(frameon=False,loc=4,labelspacing=.2)
setp(ax.get_legend().get_texts(), fontsize='small')
fig.savefig("Curve fitting.svg",bbox_inches="tight",pad_inches=.15)
|
Licensing
Krishnavedala, the copyright holder of this work, hereby publishes it under the following license:
| This file is made available under the Creative Commons CC0 1.0 Universal Public Domain Dedication. | |
| The person who associated a work with this deed has dedicated the work to the public domain by waiving all of their rights to the work worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law. You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission.
http://creativecommons.org/publicdomain/zero/1.0/deed.enCC0Creative Commons Zero, Public Domain Dedicationfalsefalse |
Captions
Add a one-line explanation of what this file represents
Items portrayed in this file
depicts
some value
6 September 2011
image/svg+xml
13c46724a90867f5da1a8a488188185038585a28
23,160 byte
384 pixel
512 pixel
File history
Click on a date/time to view the file as it appeared at that time.
| Date/Time | Thumbnail | Dimensions | User | Comment | |
|---|---|---|---|---|---|
| current | 18:05, 1 October 2014 | 512 × 384 (23 KB) | wikimediacommons>Krishnavedala | re-created using w:GNU Octave |
File usage
The following page uses this file:
Metadata
This file contains additional information, probably added from the digital camera or scanner used to create or digitize it.
If the file has been modified from its original state, some details may not fully reflect the modified file.
| Short title | Gnuplot |
|---|---|
| Image title | Produced by GNUPLOT 4.6 patchlevel 4 |
| Width | 100% |
| Height | 100% |
Retrieved from "http://70.231.62.181/index.php/File:Curve_fitting.svg"