Hey, I'm trying to use a function to sum up the microstates in an evenly split two configuration system but can't get my code to work. Here's what I have:
function sumW = microstateSum(N)n1 = N:0;n2 = 0:N;sumW = sum(factorial(N)/(factorial(n1)*factorial(n2)));
I'm getting an error on line 5, the last line, with * telling me that matrix dimension must agree. I just want the n1 and n2 variables to decrement and increment respectively but not interpret it as matrix multiplication. I was working with a for loop but couldn't get that to work either. New to Matlab.