Price-Yield Curve with Matlab

Not sure if this is the right place to ask but I was wondering if anyone has an idea about how to draw a Price-Yield curve. Is there ready-to-use formulas for this purpose ? An example of curve and formula used is below. Let me know if you require further explanation. Sorry for the formatting of the question by the way (big picture, lots of white space)

$$P=\frac{F}{[1+(\lambda/m)]^n}+\sum_{k=1}^n\frac{C/m}{[1+(\lambda/m)]^k}$$ $$=\frac{F}{[1+(\lambda/m)]^n}+\frac{C}{\lambda}\left\{1-\frac{1}{[1+(\lambda/m)]^n}\right\}.$$

-
BTW, check out quant.stackexchange.com and stats.stackexchange.com if you are interested. – user2468 Feb 17 '12 at 0:08
What's wrong with the formula you gave? Can you not just enter the formula in MatLab and plot it? – Willie Wong Feb 17 '12 at 9:29

Face value is 100:

F = 100


Coupon is 5%:

C = 5


Quarterly coupon payments:

m = 4


Five year maturity:

T = 5


Total number of payments:

n = m * T


Range of yields 1% to 20%:

y = 0.01:0.01:0.2


Prices:

P = F./(1+y/m).^n + C./y.*(1-1./(1+y/m).^n)


Plot price against yield:

plot(y,P)


Voila:

-
Thanks so much for the answer however I tried it with F = 1000 , m = 2 , n = 60 and 0 <= lambda <= 20 for the 5% coupon (this is the date for the graph I have posted) but it seems that I cant get the same shape as in the graph. Maybe I am doing something wrong ? – Cemre Feb 16 '12 at 23:38