Hello,
I need to calculate with Matlab symbolic the following expression :
"l" is a vector of symbolic variables and "C_l" also (same length than "l", that is to say, `l_max -l_min = 3000-10=2990`).
To calculate this, I did :
syms
l_min l_max fsky Np var1D varO1
l = sym(
'l_'
,[1 (l_max - l_min)])
C_l = sym(
'C_l_'
,[1 (l_max -l_min)])
var1D = symsum(2/((2*l+1)*fsky*Np^2), l, l_min, l_max)
varO1 = var1D/symsum(C_l, l_min, l_max)^2
Error using symengine
Invalid operands.
Error in sym/privBinaryOp (line 1030)
Csym = mupadmex(op,args{1}.s, args{2}.s, varargin{:});
Error in / (line 373)
X = privBinaryOp(A, B, 'symobj::mrdivide');
Error in inequality (line 9)
var1D = symsum(2/((2*l+1)*fsky*Np^2), l, l_min, l_max)
I don't know to proceed to compute the expression of sigma_o,1^2 just above (varO1 in the code snippet).
Where is my error ?
Use the element wise operator for / and ^ ... i.e. ./ and .^ as below
syms
l_min l_max fsky Np var1D var2D varO1 varO2
l_min = 10
l_min = 10
l_max = 300
l_max = 300
C_l = sym(
'C_l_'
,[1 (l_max -l_min)])