Simple question about functions
이전 댓글 표시
function nFib = fib(n)
a = (1 + sqrt(sym(5)))/2;
nFib = (a^n)-((-a)^(-n)) / sqrt(sym(5)) ;
end
*The output for this function when n=3 is
fib(3)
ans =
5^(1/2)/(5*(5^(1/2)/2 + 1/2)^3) + (5^(1/2)/2 + 1/2)^3
Why isn't the answer showing the number but just the entire function itself? And how can I solve this problem to show the actual answer(in number)? Thank you!
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Common Operations에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!