Numerical Integration inc. a Sumation in equation
I have a sumation in the equation i need to integrate,
syms k;
symsum(sym(‘k’), k, 0, 10)
works fine, as does
X = 0:1:10; Y = X.^2; Z = trapz(X,Y)
however I need to somehow combine them, like
X = 0:1:10; Y = X.^2*symsum(sym(‘X’), X, 0, 10); Z = trapz(X,Y)
but this just gives the error
??? Undefined function or method ‘normalizesym’ for input arguments of type ‘double’.
Error in ==> sym.symsum at 65
if builtin(‘numel’,x) ~= 1, x = normalizesym(x); end
How can I put a equation that is summed over a range of values, into an equation that is then numerically integrated?
(p.s. For reasons out of my control I have a nasty density fn with a summation expression nested within it, which then gets put into another density function which has to be numerically integrated. The above is a just a simple example as Im struggling to get the basics right before tackeling the monster I have to integrate!I have a sumation in the equation i need to integrate,
syms k;
symsum(sym(‘k’), k, 0, 10)
works fine, as does
X = 0:1:10; Y = X.^2; Z = trapz(X,Y)
however I need to somehow combine them, like
X = 0:1:10; Y = X.^2*symsum(sym(‘X’), X, 0, 10); Z = trapz(X,Y)
but this just gives the error
??? Undefined function or method ‘normalizesym’ for input arguments of type ‘double’.
Error in ==> sym.symsum at 65
if builtin(‘numel’,x) ~= 1, x = normalizesym(x); end
How can I put a equation that is summed over a range of values, into an equation that is then numerically integrated?
(p.s. For reasons out of my control I have a nasty density fn with a summation expression nested within it, which then gets put into another density function which has to be numerically integrated. The above is a just a simple example as Im struggling to get the basics right before tackeling the monster I have to integrate! I have a sumation in the equation i need to integrate,
syms k;
symsum(sym(‘k’), k, 0, 10)
works fine, as does
X = 0:1:10; Y = X.^2; Z = trapz(X,Y)
however I need to somehow combine them, like
X = 0:1:10; Y = X.^2*symsum(sym(‘X’), X, 0, 10); Z = trapz(X,Y)
but this just gives the error
??? Undefined function or method ‘normalizesym’ for input arguments of type ‘double’.
Error in ==> sym.symsum at 65
if builtin(‘numel’,x) ~= 1, x = normalizesym(x); end
How can I put a equation that is summed over a range of values, into an equation that is then numerically integrated?
(p.s. For reasons out of my control I have a nasty density fn with a summation expression nested within it, which then gets put into another density function which has to be numerically integrated. The above is a just a simple example as Im struggling to get the basics right before tackeling the monster I have to integrate! numerical, integration, summation, combine, trapz MATLAB Answers — New Questions