Borrar filtros
Borrar filtros

I keep getting this for my function and I don't know how to fix it -- Undefined function 'symsum' for input arguments of type 'double'.

1 visualización (últimos 30 días)
This is what have, a pic is also attached of the problem, have to find phi values of n =5,10 and 50
function phi = prob2_6(n)
phi = 13/8 + symsum(((-1).^(n+1)).*factorial(2.*n+1)./factorial(n+2).*factorial(n).*((4).^(2.*n+3)),n,0,n)
return

Respuestas (2)

Image Analyst
Image Analyst el 29 de Mayo de 2016
Can you use sum() instead?
  3 comentarios
Image Analyst
Image Analyst el 29 de Mayo de 2016
It doesn't know what the ,n,0,n arguments at the end are. What are those used for in symsum()? I don't have the symbolic toolbox so I don't know.
Alex Lisichenko
Alex Lisichenko el 17 de Mzo. de 2020
answer is
n = 0:N;
phi = 13/8 + sum(((-1).^(n+1)).*factorial(2.*n+1)./(factorial(n+2).*factorial(n).*((4).^(2.*n+3))))

Iniciar sesión para comentar.


VBBV
VBBV el 5 de En. de 2023
format long
N = [5 10 50];
Phi = prob2_6(N) % call function by passing vector of values with range N
Phi = 1×3
1.618034154176712 1.618033988674355 1.618033988749895
function phi = prob2_6(N)
for k = 1:length(N)
n = 0:N(k);
phi(k) = 13/8+sum(((-1).^(n+1).*factorial(2.*n+1))./(factorial(n+2).*factorial(n).*(4.^(2.*n+3))));
end
end

Categorías

Más información sobre Mathematics en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by