File:Linear least squares2.png
来自Wikimedia Commons
跳转到导航
跳转到搜索
本预览的尺寸:499 × 599像素。 其他分辨率:200 × 240像素 | 400 × 480像素 | 889 × 1,067像素。
原始文件 (889 × 1,067像素,文件大小:30 KB,MIME类型:image/png)
文件信息
结构化数据
说明
摘要
[编辑]Public domainPublic domainfalsefalse |
我,本作品著作权人,释出本作品至公有领域。这适用于全世界。 在一些国家这可能不合法;如果是这样的话,那么: 我无条件地授予任何人以任何目的使用本作品的权利,除非这些条件是法律规定所必需的。 |
% Illustration of linear least squares.
function main()
% KSmrq's colors
red = [0.867 0.06 0.14];
blue = [0, 129, 205]/256;
green = [0, 200, 78]/256;
yellow = [2764, 194, 0]/256;
white = 0.99*[1, 1, 1];
gray = 0.1*white;
% Set up the grid and other parameters
N = 100;
A = -2.2; B = 7;
X = linspace(A, B, N);
C=-4; D = 4;
% Set up the figure
lw = 5; % linewidth
lw2 = lw/2;
fs = 22; % font size
figure(1); clf; hold on;
set(gca, 'fontsize', fs);
set(gca, 'linewidth', lw2)
hold on; grid on;
% random numbers
s=0.16;
a = 1.7; b = 3; c = 1;
p = 1; q = 75; r = 1.3;
M = 50;
p = s*p; q = s*q; r = s*r;
XX=linspace(A, B, M+1);
YY = p+q*XX+r*XX.^2;
Xr = 7*(1:M);
Yr = Xr;
for i=1:M
rd=rand(1);
Xr(i) = XX(i)*rd+XX(i+1)*(1-rd);
Yr(i) = p+q*Xr(i)+r*Xr(i)^2 + 0.4*erfinv(2*rand(1) - 1);
end
myrad = 0.05;
for i=1:length(Xr)
ball(Xr(i), Yr(i), myrad, red);
end
axis equal;
% least squares fitting
Yr = Yr';
Xr=Xr';
Mat = [(0*Xr+1) Xr Xr.^2];
V=Mat'*Yr;
V=(Mat'*Mat)\V;
pe = V(1); qe = V(2); re=V(3);
plot(X, pe+qe*X+re*X.^2, 'b', 'linewidth', lw);
grid on;
set(gca, 'GridLineStyle', '-', 'xcolor', gray);
set(gca, 'GridLineStyle', '-', 'ycolor', gray);
set(gca, 'XTick', [-2 -1 0 1 2]);
plot([-2 2], [3.5 3.5], 'linewidth', lw2, 'color', gray);
axis equal;
axis([-2, 2, -1.7, 3.5]);
saveas(gcf, 'Linear_least_squares2.eps', 'psc2'); % save as eps
%plot2svg('Linear_least_squares.svg'); % save as svg
function ball(x, y, r, color)
Theta=0:0.7:2*pi;
X=r*cos(Theta)+x;
Y=r*sin(Theta)+y;
H=fill(X, Y, color);
set(H, 'EdgeColor', 'none')
文件历史
点击某个日期/时间查看对应时刻的文件。
日期/时间 | 缩略图 | 大小 | 用户 | 备注 | |
---|---|---|---|---|---|
当前 | 2009年2月21日 (六) 20:10 | 889 × 1,067(30 KB) | Oleg Alexandrov(留言 | 贡献) | Normal noise, per Michael Hardy | |
2008年4月5日 (六) 06:32 | 889 × 1,067(34 KB) | Oleg Alexandrov(留言 | 贡献) | tweak | ||
2008年4月5日 (六) 06:30 | 889 × 1,067(35 KB) | Oleg Alexandrov(留言 | 贡献) | tweak | ||
2008年4月5日 (六) 06:29 | 889 × 1,067(34 KB) | Oleg Alexandrov(留言 | 贡献) | tweak | ||
2008年4月5日 (六) 06:28 | 444 × 533(17 KB) | Oleg Alexandrov(留言 | 贡献) | |||
2008年4月5日 (六) 06:25 | 444 × 533(16 KB) | Oleg Alexandrov(留言 | 贡献) | tweak | ||
2008年4月5日 (六) 06:21 | 444 × 533(16 KB) | Oleg Alexandrov(留言 | 贡献) | {{Information |Description=Illustration of linear least squares. |Source=self-made with MATLAB, tweaked in Inkscape. |Date=~~~~~ |Author= Oleg Alexandrov |Permission=See below |other_versions= }} {{PD |
您不可以覆盖此文件。
文件用途
没有页面使用本文件。
全域文件用途
以下其他wiki使用此文件:
- ar.wikipedia.org上的用途
- bg.wikipedia.org上的用途
- ca.wikipedia.org上的用途
- de.wikipedia.org上的用途
- en.wikipedia.org上的用途
- eo.wikipedia.org上的用途
- es.wikipedia.org上的用途
- hi.wikipedia.org上的用途
- hu.wikipedia.org上的用途
- ja.wikipedia.org上的用途
- uk.wikipedia.org上的用途
- vi.wikipedia.org上的用途
- zh.wikipedia.org上的用途