{"id":4741,"date":"2025-03-31T13:41:04","date_gmt":"2025-03-31T04:41:04","guid":{"rendered":"https:\/\/www.ktech.biz\/jp\/?p=4741"},"modified":"2025-05-25T14:44:16","modified_gmt":"2025-05-25T05:44:16","slug":"4-lsq","status":"publish","type":"post","link":"https:\/\/www.ktech.biz\/jp\/tutorial\/4-lsq\/","title":{"rendered":"4. \u7dda\u5f62\u6700\u5c0f\u4e8c\u4e57\u6cd5"},"content":{"rendered":"\n<h3>4.1 \u6982\u8981<\/h3>\n<p>\\(m\\) \u500b\u306e\u6e2c\u5b9a\u30c7\u30fc\u30bf<br \/>\n\\[<br \/>\n(x_i, y_i) = (x_i^* + e_{x_i}, y_i^* + e_{y_i}),  i = 1, \\dots, m<br \/>\n\\]\n\u304c\u4e0e\u3048\u3089\u308c\u3066\u3044\u308b\u3082\u306e\u3068\u3057\u307e\u3059. \u3053\u3053\u3067\u305d\u308c\u305e\u308c\u306e\u30c7\u30fc\u30bf \\((x_i, y_i)\\) \u306f, \u771f\u5024 \\((x_i^*, y_i^*)\\) \u306b\u5bfe\u3057\u3066\u6e2c\u5b9a\u8aa4\u5dee (\\(e_{x_i} \u304a\u3088\u3073 e_{y_i}\\)) \u3092\u542b\u3093\u3067\u3044\u307e\u3059.<\/p>\n<p>\u5404\u70b9\u306e\u771f\u5024\u306f, \u3042\u308b\u95a2\u6570<br \/>\n\\[<br \/>\ny_i^* = F(x_i^*)<br \/>\n\\]\n\u3092\u6e80\u305f\u3059\u3082\u306e\u3068\u3057\u307e\u3059.<\/p>\n<p>\u3053\u306e\u95a2\u6570 \\(F(x)\\) \u3092 \\(n\\) \u500b\u306e\u57fa\u5e95\u95a2\u6570 \\(\\phi_j\\) \u306e\u4e00\u6b21\u7d50\u5408 \\(f(x)\\) \u306b\u3088\u308a\u8fd1\u4f3c\u3059\u308b\u3053\u3068\u306b\u3057\u307e\u3059.<br \/>\n\\[<br \/>\nF(x) \\simeq f(x) = c_1\\phi_1(x) + c_2\\phi_2(x) + \\dots + c_n\\phi_n(x)<br \/>\n\\]\n\u3053\u306e \\(f(x)\\) \u3092\u30e2\u30c7\u30eb\u95a2\u6570\u3068\u3044\u3044\u307e\u3059. \u30c7\u30fc\u30bf\u70b9\u304c\u5341\u5206\u306b\u591a\u3044\u3068\u304d (\\(m \\gg n\\)), \u30e2\u30c7\u30eb\u95a2\u6570\u304c\u30c7\u30fc\u30bf\u3092\u3067\u304d\u308b\u3060\u3051\u3046\u307e\u304f\u3042\u3066\u306f\u3081\u308b\u3088\u3046\u306a\u30d1\u30e9\u30e1\u30fc\u30bf \\(c_j (j = 1 \\sim n)\\) \u3092\u6c42\u3081\u308b\u3053\u3068\u306b\u3057\u307e\u3059.<\/p>\n<p>\u30e2\u30c7\u30eb\u95a2\u6570\u306e\u57fa\u5e95\u95a2\u6570 \\(\\phi_j\\) \u3068\u3057\u3066\u6700\u3082\u3088\u304f\u4f7f\u308f\u308c\u308b\u306e\u306f,<br \/>\n\\[<br \/>\n\\phi_j(x) = x^{j-1}<br \/>\n\\]\n\u3059\u306a\u308f\u3061, \u591a\u9805\u5f0f\u8fd1\u4f3c\u3067\u3059.<br \/>\n\\[<br \/>\nf(x) = c_1 + c_2x + \\dots + c_nx^{n-1}<br \/>\n\\]\n\u591a\u9805\u5f0f\u8fd1\u4f3c\u4ee5\u5916\u3067\u3082\u4e00\u6b21\u7d50\u5408\u3067\u8868\u3059\u3053\u3068\u304c\u3067\u304d\u308c\u3070\u540c\u3058\u3088\u3046\u306b\u6271\u3046\u3053\u3068\u304c\u3067\u304d\u307e\u3059. \u4f8b\u3048\u3070\u6b21\u306e\u3088\u3046\u306a\u5834\u5408\u3067\u3059.<\/p>\n<p>\u4e09\u89d2\u95a2\u6570\u8fd1\u4f3c\uff1a<br \/>\n\\[<br \/>\nf(x) = c_1sin(x) + c_2sin(2x) + \\dots + c_nsin(nx)<br \/>\n\\]\n\u6307\u6570\u95a2\u6570\u8fd1\u4f3c (\\(\\lambda_j\\) \u306f\u5b9a\u6570\u3068\u3059\u308b)\uff1a<br \/>\n\\[<br \/>\nf(x) = c_1exp(\\lambda_1x) + c_2exp(\\lambda_2x) + \\dots + c_nexp(\\lambda_nx)<br \/>\n\\]\n\u3055\u3066, \\(m\\) \u500b\u306e\u6e2c\u5b9a\u30c7\u30fc\u30bf\u3092\u30e2\u30c7\u30eb\u95a2\u6570\u306b\u4ee3\u5165\u3057\u3066\u7e26\u306b\u4e26\u3079\u308b\u3068\u6b21\u306e\u9023\u7acb\u4e00\u6b21\u65b9\u7a0b\u5f0f\u306b\u306a\u308a\u307e\u3059. \u3053\u308c\u3092\u89b3\u6e2c\u65b9\u7a0b\u5f0f\u3068\u3044\u3044\u307e\u3059.<br \/>\n\\[<br \/>\n\\boldsymbol{Ac} = \\boldsymbol{y}<br \/>\n\\]\n\u305f\u3060\u3057, \\(\\boldsymbol{A}\\) \u306f \\(m \\times n\\) \u4fc2\u6570\u884c\u5217\u3067, \u305d\u306e\u8981\u7d20\u306f \\(a_{ij} = \\phi_j(x_i) (i = 1 \\sim m, j = 1 \\sim n)\\) \u3067\u3059. \\(\\boldsymbol{c}\\) \u306f \\(n\\) \u89e3\u30d9\u30af\u30c8\u30eb\u3067, \u30d1\u30e9\u30e1\u30fc\u30bf \\(c_j (j = 1 \\sim n)\\) \u3092\u8981\u7d20\u3068\u3057\u307e\u3059. \\(\\boldsymbol{y}\\) \u306f \\(m\\) \u53f3\u8fba\u30d9\u30af\u30c8\u30eb\u3067, \u6e2c\u5b9a\u30c7\u30fc\u30bf \\(y_i (i = 1 \\sim m)\\) \u3092\u8981\u7d20\u3068\u3057\u307e\u3059.<\/p>\n<p>\u3053\u306e\u65b9\u7a0b\u5f0f\u306f\u672a\u77e5\u6570\u306e\u6570\u3088\u308a\u3082\u65b9\u7a0b\u5f0f\u306e\u6570\u306e\u65b9\u304c\u591a\u3044 \\((m > n)\\) \u306e\u3067\u53b3\u5bc6\u306b\u89e3\u304f\u3053\u3068\u306f\u3067\u304d\u306a\u3044 (\u4e0d\u80fd\u306a\u65b9\u7a0b\u5f0f) \u306e\u3067, \u8fd1\u4f3c\u89e3\u3092\u6c42\u3081\u308b\u3053\u3068\u306b\u3057\u307e\u3059. \u3072\u3068\u3064\u306e\u65b9\u6cd5\u3068\u3057\u3066, \u30ce\u30eb\u30e0 \\(||\\boldsymbol{Ac} &#8211; \\boldsymbol{y}||\\) \u306e\u4e8c\u4e57\u304c\u6700\u5c0f\u306b\u306a\u308b\u89e3\u3092\u6c42\u3081\u308b\u65b9\u6cd5\u304c\u6700\u5c0f\u4e8c\u4e57\u6cd5(*)\u3067\u3059. \u3053\u306e\u3068\u304d, \u89e3 \\(\\boldsymbol{c}\\) \u3092\u6700\u5c0f\u4e8c\u4e57\u89e3\u3068\u3044\u3044\u307e\u3059.<\/p>\n<hr\/>\n<p>(*) \u3059\u306a\u308f\u3061, \u6b8b\u5dee \\(r_i = f(x_i) &#8211; y_i\\) \u306e\u4e8c\u4e57\u548c \\(\\sum_{i=1}^{m}r_i^2\\) \u3092\u6700\u5c0f\u306b\u3057\u307e\u3059.<\/p>\n<hr\/>\n<h3>4.2 \u7dda\u5f62\u6700\u5c0f\u4e8c\u4e57\u6cd5\u306e\u89e3\u6cd5<\/h3>\n<p>\u6700\u5c0f\u4e8c\u4e57\u89e3\u306f \\(||\\boldsymbol{Ac} &#8211; \\boldsymbol{y}||^2\\) \u306e\u5fae\u5206\u304c 0 \u306b\u306a\u308b\u89e3\u3068\u3057\u3066\u6c42\u3081\u308b\u3053\u3068\u304c\u3067\u304d\u3066, \u6b21\u306e\u65b9\u7a0b\u5f0f\u306e\u89e3\u3068\u306a\u308a\u307e\u3059.<br \/>\n\\[<br \/>\n\\boldsymbol{A^TAc} = \\boldsymbol{A^Ty}<br \/>\n\\]\n\u3053\u308c\u3092\u6b63\u898f\u65b9\u7a0b\u5f0f\u3068\u547c\u3073, \\(\u672a\u77e5\u6570\u306e\u6570 = \u65b9\u7a0b\u5f0f\u306e\u6570 = n\\) \u3068\u306a\u308b\u306e\u3067\u89e3\u304f\u3053\u3068\u304c\u3067\u304d\u307e\u3059. \u305f\u3060\u3057, \u6b63\u898f\u65b9\u7a0b\u5f0f\u306e\u4fc2\u6570\u884c\u5217\u306e\u6761\u4ef6\u6570\u306f \\(Cond(\\boldsymbol{A^TA}) = (Cond(\\boldsymbol{A}))^2\\) \u3068\u5927\u304d\u304f\u306a\u308a\u3084\u3059\u304f\u7cbe\u5ea6\u304c\u60aa\u304f\u306a\u308b\u3053\u3068\u304c\u3042\u308a, \u3053\u306e\u89e3\u6cd5\u306f\u63a8\u5968\u3055\u308c\u307e\u305b\u3093.<\/p>\n<p>\u4ee3\u308f\u3063\u3066\u6b21\u306e QR \u5206\u89e3\u304c\u5e83\u304f\u4f7f\u308f\u308c\u3066\u3044\u307e\u3059.<br \/>\n\\[<br \/>\n\\boldsymbol{A} = \\boldsymbol{QR}<br \/>\n\\]\n\u3053\u3053\u3067, \\(\\boldsymbol{Q}\\) \u306f \\(m \\times m\\) \u76f4\u4ea4\u884c\u5217 (\\(\\boldsymbol{Q^TQ} = \\boldsymbol{I}\\)), \\(\\boldsymbol{R}\\) \u306f \\(m \\times n\\) \u4e0a\u4e09\u89d2\u884c\u5217 (\u7b2c \\(n+1 \\sim m\\) \u884c\u306f 0) \u3067\u3059. <\/p>\n<p>QR \u5206\u89e3\u306b\u3088\u308a\u5143\u306e\u9023\u7acb\u4e00\u6b21\u65b9\u7a0b\u5f0f\u306f\u6b21\u306e\u3088\u3046\u306b\u5909\u5f62\u3067\u304d\u307e\u3059.<br \/>\n\\[<br \/>\n\\begin{align}<br \/>\n&#038;\\boldsymbol{Ac} = \\boldsymbol{y} \\\\<br \/>\n&#038;\\boldsymbol{QRc} = \\boldsymbol{y} \\\\<br \/>\n&#038;\\boldsymbol{Q^TQRc} = \\boldsymbol{Q^Ty} \\\\<br \/>\n&#038;\\boldsymbol{Rc} = \\boldsymbol{Q^Ty} \\\\<br \/>\n\\end{align}<br \/>\n\\]\n\u6700\u5f8c\u306e\u5f0f\u306b\u304a\u3044\u3066, \u5de6\u8fba\u306e \\(\\boldsymbol{R}\\) \u306f\u4e0a\u4e09\u89d2\u884c\u5217\u306a\u306e\u3067\u4ee3\u5165\u64cd\u4f5c\u3060\u3051\u3067\u5bb9\u6613\u306b \\(\\boldsymbol{c}\\) \u3092\u6c42\u3081\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059. \u3053\u3046\u3057\u3066\u6c42\u3081\u305f \\(\\boldsymbol{c}\\) \u306f\u6700\u5c0f\u4e8c\u4e57\u89e3\u306b\u306a\u3063\u3066\u3044\u307e\u3059.<\/p>\n<p>\u30d1\u30e9\u30e1\u30fc\u30bf\u6570 \\(n\\) \u306f\u3080\u3084\u307f\u306b\u5927\u304d\u304f\u3059\u308c\u3070\u3088\u3044\u3068\u3044\u3046\u3082\u306e\u3067\u306f\u3042\u308a\u307e\u305b\u3093. \u4f8b\u3048\u3070, \u660e\u3089\u304b\u306b\u76f4\u7dda\u306b\u306e\u3063\u3066\u3044\u308b\u30c7\u30fc\u30bf\u3092 2 \u6b21\u4ee5\u4e0a\u306e\u591a\u9805\u5f0f\u3067\u8fd1\u4f3c\u3057\u3066\u3082\u610f\u5473\u304c\u3042\u308a\u307e\u305b\u3093. \\(n\\) \u304c\u5927\u304d\u3059\u304e\u308b\u3068\u4fc2\u6570\u884c\u5217 \\(\\boldsymbol{A}\\) \u306e\u5217\u304c\u4e00\u6b21\u5f93\u5c5e\u306b\u306a\u3063\u3066\u3057\u307e\u3044, QR \u5206\u89e3\u304c\u5931\u6557\u3057\u307e\u3059. \u3053\u308c\u3092\u30e9\u30f3\u30af\u843d\u3061\u3068\u3044\u3044\u307e\u3059 (\u30e9\u30f3\u30af\u6570\u306f\u4e00\u6b21\u72ec\u7acb\u306a\u5217\u306e\u6570\u3067\u3059). \u3053\u306e\u3088\u3046\u306a\u5834\u5408\u306b\u306f\u30e2\u30c7\u30eb\u95a2\u6570\u306e\u898b\u76f4\u3057\u304c\u5fc5\u8981\u3067\u3059.<\/p>\n<h3>4.3 XLPack \u3092\u4f7f\u3063\u305f\u7dda\u5f62\u6700\u5c0f\u4e8c\u4e57\u6cd5\u306e\u89e3\u304d\u65b9<\/h3>\n<p>VBA \u30b5\u30d6\u30eb\u30fc\u30c1\u30f3 <strong>Dgels<\/strong> \u3042\u308b\u3044\u306f\u30ef\u30fc\u30af\u30b7\u30fc\u30c8\u95a2\u6570 <strong>WDgels<\/strong> \u3092\u4f7f\u3046\u3053\u3068\u306b\u3088\u308a\u7cbe\u5ea6\u3088\u304f\u6700\u5c0f\u4e8c\u4e57\u89e3\u3092\u6c42\u3081\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059.<\/p>\n<p>\u3053\u308c\u3089\u306f, \u7dda\u5f62\u8a08\u7b97\u30e9\u30a4\u30d6\u30e9\u30ea LAPACK \u306e\u30b5\u30d6\u30eb\u30fc\u30c1\u30f3 DGELS \u3092\u4f7f\u7528\u3057\u3066\u304a\u308a, QR \u5206\u89e3\u306b\u3088\u308a\u6700\u5c0f\u4e8c\u4e57\u89e3\u3092\u6c42\u3081\u307e\u3059. \u305f\u3060\u3057, \u30e9\u30f3\u30af\u843d\u3061\u304c\u3042\u3063\u3066\u306f\u3044\u3051\u307e\u305b\u3093.<\/p>\n<h5>\u4f8b\u984c: \u591a\u9805\u5f0f\u8fd1\u4f3c<\/h5>\n<p>\u6b21\u306e\u30c7\u30fc\u30bf\u306f \u30a2\u30e1\u30ea\u30ab\u56fd\u7acb\u6a19\u6e96\u6280\u8853\u7814\u7a76\u6240 (NIST) \u306e\u30db\u30fc\u30e0\u30da\u30fc\u30b8 (<a href=\"http:\/\/www.itl.nist.gov\/div898\/strd\/lls\/data\/Norris.shtml\">http:\/\/www.itl.nist.gov\/div898\/strd\/lls\/data\/Norris.shtml<\/a>) \u306b\u63b2\u8f09\u3055\u308c\u3066\u3044\u308b\u30c6\u30b9\u30c8\u30c7\u30fc\u30bf\u3067\u3059.<\/p>\n<pre> \r\n     y          x\r\n    0.1        0.2\r\n  338.8      337.4\r\n  118.1      118.2\r\n  888.0      884.6\r\n    9.2       10.1\r\n  228.1      226.5\r\n  668.5      666.3\r\n  998.5      996.3\r\n  449.1      448.6\r\n  778.9      777.0\r\n  559.2      558.2\r\n    0.3        0.4\r\n    0.1        0.6\r\n  778.1      775.5\r\n  668.8      666.9\r\n  339.3      338.0\r\n  448.9      447.5\r\n   10.8       11.6\r\n  557.7      556.0\r\n  228.3      228.1\r\n  998.0      995.8\r\n  888.8      887.6\r\n  119.6      120.2\r\n    0.3        0.3\r\n    0.6        0.3\r\n  557.6      556.8\r\n  339.3      339.1\r\n  888.0      887.2\r\n  998.5      999.0\r\n  778.9      779.0\r\n   10.2       11.1\r\n  117.6      118.3\r\n  228.9      229.2\r\n  668.4      669.1\r\n  449.2      448.9\r\n    0.2        0.5\r\n\r\n<\/pre>\n<p>&nbsp;<br \/>\n\u3053\u308c\u3092 1 \u6b21\u591a\u9805\u5f0f(\u76f4\u7dda)<br \/>\n\\[<br \/>\nf(x) = c_1 + c_2x<br \/>\n\\]\n\u306b\u3088\u308a\u8fd1\u4f3c\u3057\u307e\u3059.<\/p>\n<h4>4.3.1 \u30ef\u30fc\u30af\u30b7\u30fc\u30c8\u95a2\u6570\u3092\u4f7f\u7528\u3057\u305f\u89e3\u304d\u65b9<\/h4>\n<p>(1) \u30ef\u30fc\u30af\u30b7\u30fc\u30c8\u306e\u9069\u5f53\u306a\u5834\u6240\u306b\u30c7\u30fc\u30bf\u3092\u5165\u529b\u3057\u307e\u3059(\u30aa\u30ec\u30f3\u30b8\u8272\u306e\u30bb\u30eb).<\/p>\n<p>(2) \u4fc2\u6570\u884c\u5217 \\(\\boldsymbol{A} \\space (a_{ij} = \\phi_j(x_i) (i = 1 \\sim m, j = 1 \\sim n))\\) \u3092\u4f5c\u308a\u307e\u3059. \u3053\u306e\u5834\u5408\u306f, \\(a_{i1} = 1, a_{i2} = x_i (i = 1 \\sim m)\\) \u3068\u306a\u308a\u307e\u3059.<\/p>\n<p>(3) \u6c42\u3081\u308b\u30d1\u30e9\u30e1\u30fc\u30bf \\(\\boldsymbol{c}\\) \u304a\u3088\u3073\u305d\u306e\u4ed6\u306e\u7d50\u679c\u3092\u5165\u308c\u308b \\(n + 2\\) \u500b\u306e\u30bb\u30eb\u3092\u9078\u629e\u3057\u3066\u30ef\u30fc\u30af\u30b7\u30fc\u30c8\u95a2\u6570 <strong>WDgels<\/strong> \u3092\u8a2d\u5b9a\u3057\u307e\u3059 (\u7dd1\u8272\u306e\u30bb\u30eb).<\/p>\n<p><strong>WDgels<\/strong> \u306e\u5fc5\u8981\u306a\u30d1\u30e9\u30e1\u30fc\u30bf\u306f, Trans, Cov, M, N, A, B, Nrhs \u3067\u3059.<br \/>\nTrans: &#8220;N&#8221;: \\(\\boldsymbol{Ax} = \\boldsymbol{b}\\) \u3092\u89e3\u304f. &#8220;T&#8221;: \\(\\boldsymbol{A^Tx} = \\boldsymbol{b}\\) \u3092\u89e3\u304f.<br \/>\nCov: &#8220;N&#8221;: \u5206\u6563\u5171\u5206\u6563\u884c\u5217\u3092\u8a08\u7b97\u3057\u306a\u3044. &#8220;D&#8221;: \u5206\u6563 (\u5206\u6563\u5171\u5206\u6563\u884c\u5217\u306e\u5bfe\u89d2\u8981\u7d20) \u3092\u8a08\u7b97\u3059\u308b. &#8220;C&#8221;: \u5206\u6563\u5171\u5206\u6563\u884c\u5217\u3092\u8a08\u7b97\u3059\u308b.<br \/>\nM: \u30c7\u30fc\u30bf\u6570.<br \/>\nN: \u30d1\u30e9\u30e1\u30fc\u30bf\u6570 (\u3053\u306e\u4f8b\u3067\u306f 2).<br \/>\nA: \u884c\u5217 \\(\\boldsymbol{A}\\) \u306e\u30bb\u30eb\u7bc4\u56f2.<br \/>\nB: \u53f3\u8fba\u30d9\u30af\u30c8\u30eb (= \u30d9\u30af\u30c8\u30eb \\(\\boldsymbol{y}\\)) \u306e\u30bb\u30eb\u7bc4\u56f2.<br \/>\nNrhs: \u53f3\u8fba\u30d9\u30af\u30c8\u30eb\u306e\u672c\u6570 (\\(\\boldsymbol{y}\\) \u3060\u3051\u5909\u3048\u3066\u8907\u6570\u56de\u8a08\u7b97\u3059\u308b\u5834\u5408\u306b\u5165\u529b. \u7701\u7565\u6642\u306f 1 \u3068\u307f\u306a\u3059).<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.ktech.biz\/jp\/wp-content\/uploads\/sites\/2\/2015\/10\/Ex4W_3.png\" alt=\"\" width=\"978\" height=\"786\" class=\"aligncenter size-full wp-image-4092\" srcset=\"https:\/\/www.ktech.biz\/jp\/wp-content\/uploads\/sites\/2\/2015\/10\/Ex4W_3.png 978w, https:\/\/www.ktech.biz\/jp\/wp-content\/uploads\/sites\/2\/2015\/10\/Ex4W_3-300x241.png 300w, https:\/\/www.ktech.biz\/jp\/wp-content\/uploads\/sites\/2\/2015\/10\/Ex4W_3-768x617.png 768w\" sizes=\"auto, (max-width: 978px) 100vw, 978px\" \/><\/p>\n<p>\u5165\u529b\u304c\u7d42\u4e86\u3057\u305f\u3089 Ctrl + Shift + Enter \u3092\u62bc\u3059\u3068\u7d50\u679c\u304c\u5f97\u3089\u308c\u307e\u3059. \u3053\u3053\u3067\u306f, \u30c7\u30fc\u30bf\u3092\u4e38\u3067, \u8a08\u7b97\u5024\u3092\u76f4\u7dda\u3067\u8868\u3059\u30b0\u30e9\u30d5\u3082\u4f5c\u6210\u3057\u3066\u307f\u307e\u3057\u305f.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.ktech.biz\/jp\/wp-content\/uploads\/sites\/2\/2015\/10\/Ex4W_4.png\" alt=\"\" width=\"979\" height=\"786\" class=\"aligncenter size-full wp-image-4098\" \/><\/p>\n<p>2\u3064\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u304c\u6c42\u3081\u3089\u308c\u307e\u3057\u305f (\\(c_1 = -0.26232, c_2 = 1.002117\\)). \u3053\u308c\u3089\u306f, NIST \u306e\u5024\u3068\u3074\u3063\u305f\u308a\u4e00\u81f4\u3057\u3066\u3044\u307e\u3059.<\/p>\n<h4>4.3.2 VBA\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u4f7f\u7528\u3057\u305f\u89e3\u304d\u65b9<\/h4>\n<p>\u4e0a\u3068\u540c\u3058\u4f8b\u984c\u3092 VBA \u30d7\u30ed\u30b0\u30e9\u30e0\u306b\u3088\u308a\u89e3\u304d\u307e\u3059. <strong>Dgels<\/strong> \u3092\u4f7f\u3063\u305f\u30d7\u30ed\u30b0\u30e9\u30e0\u4f8b\u3092\u793a\u3057\u307e\u3059.<\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism line-numbers lang-vb\" data-lang=\"VBA\"><code>Sub Start()\r\n    Const MMax = 100, NMax = 5\r\n    Dim M As Long, N As Long\r\n    Dim A(MMax, NMax) As Double, B(MMax) As Double\r\n    Dim Info As Long, I As Long, J As Long\r\n    '--- Input data\r\n    M = 36: N = 2\r\n    For I = 0 To M - 1\r\n        For J = 0 To N - 1\r\n            A(I, J) = Cells(5 + I, 3 + J)\r\n        Next\r\n        B(I) = Cells(5 + I, 2)\r\n    Next\r\n    '--- Compute least squares solution\r\n    Call Dgels(\"N\", M, N, A(), B(), Info)\r\n    '--- Output result\r\n    For J = 0 To N - 1\r\n        Cells(5 + J, 5) = B(J)\r\n    Next\r\n    Cells(7, 5) = Info\r\nEnd Sub<\/code><\/pre>\n<\/div>\n<p>\u6240\u5b9a\u306e\u4f4d\u7f6e\u306b\u30c7\u30fc\u30bf\u3092\u5165\u529b\u3057, \u30de\u30af\u30ed Start \u3092\u5b9f\u884c\u3059\u308b\u3068\u6b21\u306e\u3088\u3046\u306b\u4e0a\u3068\u540c\u3058\u7d50\u679c\u304c\u5f97\u3089\u308c\u307e\u3059. \u30ef\u30fc\u30af\u30b7\u30fc\u30c8\u95a2\u6570\u3092\u4f7f\u7528\u3057\u305f\u3068\u304d\u3068\u7570\u306a\u308a, \u4fc2\u6570\u884c\u5217 \\(\\boldsymbol{A}\\) \u3068\u53f3\u8fba\u30d9\u30af\u30c8\u30eb \\(\\boldsymbol{b}\\) \u306e\u5024\u3092\u5165\u529b\u3057\u305f\u3060\u3051\u3067\u306f\u7d50\u679c\u304c\u5f97\u3089\u308c\u305a, VBA \u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u5b9f\u884c\u3057\u3066\u3084\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.ktech.biz\/jp\/wp-content\/uploads\/sites\/2\/2015\/10\/Ex4_1.png\" alt=\"\" width=\"979\" height=\"786\" class=\"aligncenter size-full wp-image-4097\" srcset=\"https:\/\/www.ktech.biz\/jp\/wp-content\/uploads\/sites\/2\/2015\/10\/Ex4_1.png 979w, https:\/\/www.ktech.biz\/jp\/wp-content\/uploads\/sites\/2\/2015\/10\/Ex4_1-300x241.png 300w, https:\/\/www.ktech.biz\/jp\/wp-content\/uploads\/sites\/2\/2015\/10\/Ex4_1-768x617.png 768w\" sizes=\"auto, (max-width: 979px) 100vw, 979px\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u7dda\u5f62\u6700\u5c0f\u4e8c\u4e57\u6cd5\u306e\u89e3\u6cd5\u3068XLPack\u3092\u4f7f\u3063\u305f\u89e3\u304d\u65b9<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[10],"tags":[],"class_list":["post-4741","post","type-post","status-publish","format-standard","hentry","category-tutorial"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.ktech.biz\/jp\/wp-json\/wp\/v2\/posts\/4741","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ktech.biz\/jp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ktech.biz\/jp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ktech.biz\/jp\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ktech.biz\/jp\/wp-json\/wp\/v2\/comments?post=4741"}],"version-history":[{"count":5,"href":"https:\/\/www.ktech.biz\/jp\/wp-json\/wp\/v2\/posts\/4741\/revisions"}],"predecessor-version":[{"id":5070,"href":"https:\/\/www.ktech.biz\/jp\/wp-json\/wp\/v2\/posts\/4741\/revisions\/5070"}],"wp:attachment":[{"href":"https:\/\/www.ktech.biz\/jp\/wp-json\/wp\/v2\/media?parent=4741"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ktech.biz\/jp\/wp-json\/wp\/v2\/categories?post=4741"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ktech.biz\/jp\/wp-json\/wp\/v2\/tags?post=4741"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}