10-5 �D�u�ʰj�k�G�ϥ��ܧΪk

°£¦¹¤§¥~¡A§Ú­Ì¥ç¥i§Q¥ÎÅܧΪk¡]Transformation¡^¡A±N¤@¼Æ¾Ç¼Ò«¬Âà´«¦¨¥u¥]§t½u©Ê°Ñ¼Æªº¼Ò«¬¡C¨Ò¦p¡A°²³]¤@¼Ò«¬¬°¡G $$ y=ae^{bx} $$

¨ú¦ÛµM¹ï¼Æ¡A¥i±o

$$ \ln y = \ln a + bx $$

¦¹®É¡A$\ln a$ ¤Î $b$ Åܦ¨½u©Ê°Ñ¼Æ¡A§Ú­Ì¥i¥Î¡§³Ì¤p¥­¤èªk¡¨§ä¥X¨ä­È¡A½Ð¨£¤U¦C¨Ï¥ÎÅܧΪkªº½d¨Ò¡G

Example 1: 10-¦±½uÀÀ¦X»P°jÂk¤ÀªR/transformFit01.mload data2.txt x = data2(:, 1); % ¤wª¾¸ê®ÆÂIªº x ®y¼Ð y = data2(:, 2); % ¤wª¾¸ê®ÆÂIªº y ®y¼Ð A = [ones(size(x)) x]; theta = A\log(y); subplot(2,1,1) plot(x, log(y), 'o', x, A*theta); xlabel('x'); ylabel('ln(y)'); title('ln(y) vs. x'); legend('Actual value', 'Predicted value'); a = exp(theta(1)) % ¿ëÃѱo¨ì¤§°Ñ¼Æ b = theta(2) % ¿ëÃѱo¨ì¤§°Ñ¼Æ y2 = a*exp(b*x); subplot(2,1,2); plot(x, y, 'o', x, y2); xlabel('x'); ylabel('y'); legend('Actual value', 'Predicted value'); title('y vs. x'); fprintf('»~®t¥­¤è©M = %d\n', sum((y-y2).^2)); a = 4.3282 b = -1.8235 »~®t¥­¤è©M = 8.744185e-01

¦b¤W­z¹Ï§Î¤¤¡A²Ä¤@­Ó¤p¹Ï¬O $\ln y$ ¹ï $x$ ªº§@¹Ï¡A¦Ó²Ä¤G­Ó¤p«h¬O $y$ ¹ï $x$ ªº§@¹Ï¡C½Ð¯S§Oª`·N¡A¸g¥ÑÅܧΪk¤§«á¡A¦¹³Ì¤p¥­¤èªk©Ò±o¨ìªº³Ì¤pÁ`¥­¤è»~®t¬O $$ E'=\sum_{i=1}^m (\ln y_i - \ln a - bx_i)^2 $$

¦Ó¤£¬O­ì¼Ò«¬ªºÁ`¥­¤è»~®t¡G $$ E=\sum_{i=1}^m (y_i - ae^{bx_i})^2 $$

³q±` $E'$ ¬°³Ì¤p­È®É¡A$E$ ¤£¤@©w¬O³Ì¤p­È¡A¦ý³q±`¥çÂ÷³Ì¤p­È¥ç¤£»·¨o¡I­Y­nºë¯q¨Dºë¡A¥i¦A¥Î fminsearch ¨D¨ú $E$ ªº³Ì¤p­È¡A¨Ã¥H¡]ÅܧΫá¡^³Ì¤p¥­¤èªk±o¨ìªº a ¤Î b ¬°·j´Mªº°_ÂI¡A½Ð¨£¤U¦C½d¨Ò¡G

Example 2: 10-¦±½uÀÀ¦X»P°jÂk¤ÀªR/transformFit02.mload data2.txt x = data2(:, 1); % ¤wª¾¸ê®ÆÂIªº x ®y¼Ð y = data2(:, 2); % ¤wª¾¸ê®ÆÂIªº y ®y¼Ð A = [ones(size(x)) x]; theta = A\log(y); a = exp(theta(1)) % ¿ëÃѱo¨ì¤§°Ñ¼Æ b = theta(2) % ¿ëÃѱo¨ì¤§°Ñ¼Æ theta0 = [a, b]; % fminsearch ªº±Ò©l°Ñ¼Æ theta = fminsearch(@(x)errorMeasure3(x, data2), theta0); x = data2(:, 1); y = data2(:, 2); y2 = theta(1)*exp(theta(2)*x); plot(x, y, 'o', x, y2); xlabel('x'); ylabel('y'); legend('Actual value', 'Predicted value'); title('y vs. x'); fprintf('»~®t¥­¤è©M = %d\n', sum((y-y2).^2)); a = 4.3282 b = -1.8235 »~®t¥­¤è©M = 1.680455e-01

¥Ñ¤W­z½d¨Ò¥i¥H¬Ý¥X¡A§Ú­Ì¥i¥H¥ý¨Ï¥ÎÅܧΪk¡A¥ý§ä¥X¤j²¤ªº°Ñ¼Æ­È¡AµM«á¦A¥Î fminsearch ¨Ó¹ï»~®t¥­¤è©M¶i¦æ³Ì¤p¤Æ¡A¦]¦¹±o¨ìªº»~®t¥­¤è©M¡A·|¤ñ«e¤@­Ó½d¨Ò¡]¥u¥ÎÅܧΪk¡^ÁÙ­n¤p¡C¡]·íµM¡A¦b³o­Ó½d¨Ò¤¤¡A§Ú­Ì©w¸q¤F¤@­Ó¥²¶·³Q³Ì¤p¤Æªº»~®tÁ`©M¨ç¦¡ errorMeasure3.m¡A¬°¸`¬Ù½g´T¡A¨ä¤º®e¤£¦A¦C¥X¡AŪªÌ½Ð¦Û¦æ°Ñ¦Ò¥úºÐ¤¤ªºÀɮסC¡^

¨Æ¹ê¤W¡A«Ü¦h¬Ý°_¨Ó¬O«D½u©Êªº°jÂk¼Ò«¬¡A¸g¹L¤F¤@¨ÇÂà´««á¡A´N·|Åܦ¨½u©Êªº°jÂk¼Ò«¬¡A¦]¦¹´N¥i¥H¨Ï¥Î§Ú­Ì³o¤@¸`©Ò»¡©úªºÅܧΪk¡A¨Ó¶i¦æ½u©Ê°jÂkªº°Ñ¼Æ¨D¨ú¡C¥H¤U¬O¤@¨ÇÅܧΪk¥i¥Îªº«D½u©Ê¼Ò«¬¡A¥H¤Î¬ÛÃöªºÂà´«¤èªk¡G

½s¸¹ «D½u©Ê¼Ò«¬ Âà´««áªº½u©Ê¼Ò«¬ °Ñ¼ÆÂà´«¤½¦¡
1 $y=\frac{ax}{1+bx}$ $\underbrace{\frac{1}{y}}_Y=\underbrace{\frac{1}{a}}_\alpha \frac{1}{x}+\underbrace{\frac{b}{a}}_\beta$ $a=\frac{1}{\alpha}$, $b=\frac{\beta}{\alpha}$
2 $y=\frac{a}{x+b}$ $\underbrace{\frac{1}{y}}_Y=\underbrace{\frac{1}{a}}_\alpha x+\underbrace{\frac{b}{a}}_\beta$ $a=\frac{1}{\alpha}$, $b=\frac{\beta}{\alpha}$
3 $y=\frac{ax}{x^2+b^2}$ $\underbrace{\frac{1}{y}}_Y=\underbrace{\frac{1}{a}}_\alpha x+\underbrace{\frac{b^2}{a}}_\beta \frac{1}{x}$ $a=\frac{1}{\alpha}$, $b=\pm\sqrt{\frac{\beta}{\alpha}}$
4 $y=ax^b$ $\underbrace{\ln y}_Y = \underbrace{b}_\alpha \ln x + \underbrace{\ln a}_\beta$ $a=e^\beta, b=\alpha$
5 $y=\frac{1}{1+ax^b}$ $\underbrace{\ln \frac{1-y}{y}}_Y = \underbrace{b}_\alpha \ln x + \underbrace{\ln a}_\beta$ $a=e^\beta, b=\alpha$
6 $y=\frac{1}{1+exp\left(\frac{ax}{b+x}\right)}$ $\underbrace{\left[\ln \frac{1-y}{y}\right]^{-1}}_Y=\underbrace{\frac{b}{a}}_\alpha \frac{1}{x}+\underbrace{\frac{1}{a}}_\beta$ $a=\frac{1}{\beta}, b=\frac{\alpha}{\beta}$
7 $y=\ln a + x - \ln (e^x+b)$ $\underbrace{e^{-y}}_Y=\underbrace{\frac{b}{a}}_\alpha e^x+\underbrace{\frac{1}{a}}_\beta$ $a=\frac{1}{\beta}, b=\frac{\alpha}{\beta}$
8 $\frac{x^2}{a^2} + \frac{y^2}{b^2} = 1$ $\underbrace{y^2}_Y=\underbrace{-\frac{b^2}{a^2}}_\alpha x^2+\underbrace{b^2}_\beta$ $a^2=-\frac{\beta}{\alpha}, b^2=\beta$
9 $(x-a)^2+(y-b)^2=c^2$ $\underbrace{x^2+y^2}_Y=\underbrace{2a}_\alpha x+\underbrace{2b}_\beta y+\underbrace{c^2-a^2-b^2}_\gamma$ $a=\alpha/2, b=\beta/2\\c=\gamma+\frac{\alpha^2}{4}+\frac{\beta^2}{4}$
10 $y=a e^{\left[-\left(\frac{x-c}{b}\right)^2\right]}$ $\underbrace{\ln y}_Y = \underbrace{-\frac{1}{b^2}}_\alpha x^2+ \underbrace{\frac{2c}{b^2}}_\beta x+\underbrace{\ln a-\frac{c^2}{b^2}}_\gamma$ $a=exp \left( \gamma - \frac{\beta^2}{4}\right)\\b=\pm \sqrt{-\frac{1}{\alpha}}\\c=-\frac{\beta}{2\alpha}$
11 $y=\frac{a}{\sqrt{(1+bx^2)^2+c}}$ $\underbrace{\frac{1}{y^2}}_Y=\underbrace{\frac{b^2}{a^2}}_\alpha x^4+\underbrace{\frac{2b}{a^2}}_\beta x^2+\underbrace{\frac{c+1}{a^2}}_\gamma$ $a=\pm\frac{\sqrt{4\alpha}}{\beta}\\b=\frac{2\alpha}{\beta}\\c=\frac{4\alpha\gamma}{\beta^2}-1$

MATLABµ{¦¡³]­p¡G¶i¶¥½g