Taking the sum of exponentials
5 views (last 30 days)
To do the calculation,
is the following code correct? Is the (:) necessary? I think that makes a column vector, but I don't think it's necessary. I don't think cumsum would be useful here. Could somebody please advise? If it matters, . And a is a vector of .
x = linspace(0.01,100,10000);
f_x = sum(exp(-x./a(:)));
Star Strider on 22 Mar 2022
‘If it matters, . And a is a vector of .’
I don’t see ‘t’ defined anywhere, so it depends on what relationship ‘t’ has to ‘x’ or a.
However, since as @_ noted, since a is already a column vector by definition, the (:) is not necessary. The important aspect is that with respect to MATLAB coding, ‘x./a’ must be a matrix in order that sum produces the row vector necessary for the result.