to compute some basic computational algorithms, and, might need a ride on someone's back if you do not mind:
f = @(x) nchoosek(5,x)*0.1.^x*0.9.^(5-x)
f =
@(x) nchoosek (5, x) * 0.1 .^ x * 0.9 .^ (5 - x)
>> sum(f([0:5]))
error: Invalid call to nchoosek. Correct usage is:
-- Function File: C = nchoosek (N, K)
-- Function File: C = nchoosek (SET, K)
How do I call the function therefore?
Example required
error: called from
print_usage at line 90 column 5
nchoosek at line 96 column 5
at line -1 column -1
error: evaluating argument list element number 1
>> sum([1:5]);
>> ans = sum([1:5]);
>> ans
ans = 15
I am trying to compare this with MathLab as well, but I have some stumbling blocks with MathLab.
Regards,
--
Jonathan Camilleri
E-mail:
address@hiddenPlease consider your environmental responsibility before printing this e-mail.
I usually reply to emails within 2 business days. If it's urgent, give me a call.