'How to use Octave to plot for birthday problem?

I figured out I can write a function to calculate the probability of at least two share the same birthday:

function retval = bday (total, n)
    retval= 1- prod((total - n + 1: total)/total)
endfunction

octave:62> bday(365, 23)
retval = 0.5073
ans = 0.5073

Now if I hope to plot a 3d chart using mesh, where total is a vector 1000:100:2000, and n is another vector 20:5:40. How should I do it?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source