diary-2008-02-14 lect7_spec plot(x,y) lect7_spec [month total]=loan(25000,7.5,4) month = 600.72 total = 28834.47 a=70000; b=6.5; [x y]=loan(a,b,30) x = 440.06 y = 158423.02 help loan loan calculates monthly and total payment of a loan. Input arguments: amount loan amount in $ rate annual interest rate in percent years number of years Output arguments: mpay monthly payment tpay total payment Author: Alan Usas, 2/9/08 Example7_1(6) ans = 4.54 x=1:2:11 x = Column 1 1.00 Column 2 3.00 Column 3 5.00 Column 4 7.00 Column 5 9.00 Column 6 11.00 Example7_1(x) ans = Column 1 0.71 Column 2 3.03 Column 3 4.13 Column 4 4.90 Column 5 5.52 Column 6 6.06 Example7_1([1:2:11]) ans = Columns 1 through 2 0.71 3.03 Columns 3 through 4 4.13 4.90 Columns 5 through 6 5.52 6.06 Ex7_2 The change in the area is 0.01346 square meters. FA=@(x) exp(x^2)/sqrt(x^2+5) FA = @(x)exp(x^2)/sqrt(x^2+5) FA(2) ans = 18.20 z=FA(3) z = 2165.64 FA=@(x) exp(x.^2)/sqrt(x.^2+5) FA = @(x)exp(x.^2)/sqrt(x.^2+5) FA([1 0.5 2]) ans = 8.56 FA=@(x) exp(x.^2)./sqrt(x.^2+5) FA = @(x)exp(x.^2)./sqrt(x.^2+5) FA([1 0.5 2]) ans = 1.11 0.56 18.20 HA=@(x,y)2*x^2-4*x*y+y^2 HA = @(x,y)2*x^2-4*x*y+y^2 HA(2,3) ans = -7.00 lect7_1 d = @(rA,thetaA,rB,thetaB)sqrt(rA^2+rB^2-2*rA*rB*cos(thetaB-thetaA)) distAtoB=d(2,pi/6,5,3*pi/4) distAtoB = 5.85