Hello, I am trying to create a matlab script that calculates an atomic scattering factor dependent on a,b,s,z where z is the atomic number, a and b are a 4 term array I will be getting from my course textbook, and s is sin(theta)/lambda which I will be calculating by hand as part of my homework. Not sure why I am having this difficulty but it seems my matlab is much ruster than I thought, but I would rather do this than an excel spreadsheet.
Equation should look something like:
My code currently looks like this:
function f = f(z,s,a,b)
f =(z^2)-41.78214*(s.^2)*symsum(a.*(exp(1).^-b.*(s.^2)),[a,b],[1 4]);
Varaible are curently:
When I remove the summation I get an answer (woohoo!), but when i try to use the summation it really gives me the error:
Error: File: Scatteringfactor.m Line: 3 Column: 67
Unbalanced or unexpected parenthesis or bracket.
I suspect I am misusing the symsum function or there is a smarter way of doing this.