正在加载图片...
1.1. The Golden Ratio (x1) Figure 1.2. f(o)=0 The name ezplot stands for "easy plot, although some of the English-speaking world would pronounce it"e-zed plot " Even though f(a) becomes infinite as a-0, ezplot automatically picks a reasonable vertical scale The statement phi fzero(f, 1) looks for a zero of f(a)near a =1. It produces an approximation to o that is accurate to almost full precision. The result can be inserted in Figure 1. 2 with hold on plot(phi,0,o') The following MATLAB program produces the picture of the golden rectangle shown in Figure 1. 1. The program is contained in an M-file named goldrect.m, so goldrect 7 GOLDRECT Plot the golden rectangle hi=(1+sqrt(5))/2 to phi phi 0 oJ y [00110] u=[11]; [01] plot(x,y, 'b,,u,v,'b--) text (phi/2, 1.05, '\phi ')1.1. The Golden Ratio 5 0 0.5 1 1.5 2 2.5 3 3.5 4 −3 −2 −1 0 1 2 3 4 5 6 7 x 1/x − (x−1) Figure 1.2. f(φ) = 0. The name ezplot stands for “easy plot,” although some of the English-speaking world would pronounce it “e-zed plot.” Even though f(x) becomes infinite as x → 0, ezplot automatically picks a reasonable vertical scale. The statement phi = fzero(f,1) looks for a zero of f(x) near x = 1. It produces an approximation to φ that is accurate to almost full precision. The result can be inserted in Figure 1.2 with hold on plot(phi,0,’o’) The following Matlab program produces the picture of the golden rectangle shown in Figure 1.1. The program is contained in an M-file named goldrect.m, so issuing the command goldrect runs the script and creates the picture. % GOLDRECT Plot the golden rectangle phi = (1+sqrt(5))/2; x = [0 phi phi 0 0]; y = [0 0 1 1 0]; u = [1 1]; v = [0 1]; plot(x,y,’b’,u,v,’b--’) text(phi/2,1.05,’\phi’)
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有