File:Curve fitting.svg
来自testwiki
跳转到导航
跳转到搜索
此SVG文件的PNG预览的大小:512 × 384像素。 其他分辨率:320 × 240像素 | 640 × 480像素 | 1,024 × 768像素 | 1,280 × 960像素 | 2,560 × 1,920像素。
原始文件 (SVG文件,尺寸为512 × 384像素,文件大小:23 KB)
本文件来自维基共享资源并可能被其他项目使用。 其文件描述页上的描述显示在下面。
摘要
| 描述Curve 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. |
| 日期 | |
| 来源 | 自己的作品 |
| 作者 | Krishnavedala |
| 其他版本 |
|
| SVG开发 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)
|
许可协议
Krishnavedala,本作品著作权人,特此采用以下许可协议发表本作品:
| 本作品采用知识共享CC0 1.0 通用公有领域贡献许可协议授权。 | |
| 采用本宣告发表本作品的人,已在法律允许的范围内,通过在全世界放弃其对本作品拥有的著作权法规定的所有权利(包括所有相关权利),将本作品贡献至公有领域。您可以复制、修改、传播和表演本作品,将其用于商业目的,无需要求授权。
http://creativecommons.org/publicdomain/zero/1.0/deed.enCC0Creative Commons Zero, Public Domain Dedicationfalsefalse |
说明
添加一行文字以描述该文件所表现的内容
此文件中描述的项目
描繪內容
某些值没有维基数据项目
6 9 2011
image/svg+xml
23,160 字节
384 像素
512 像素
创作所用软件 简体中文(已转写)
文件历史
点击某个日期/时间查看对应时刻的文件。
| 日期/时间 | 缩略图 | 大小 | 用户 | 备注 | |
|---|---|---|---|---|---|
| 当前 | 2014年10月1日 (三) 19:05 | 512 × 384(23 KB) | wikimediacommons>Krishnavedala | re-created using w:GNU Octave |
文件用途
以下页面使用本文件: