Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Matlab Function fibonacci series

조회 수: 4 (최근 30일)
Gurkan Gules
Gurkan Gules 2018년 1월 14일
댓글: Jan 2018년 1월 15일
Write a matlab function entitled fibonacci which accepts an integer n and computes the nth Fibonacci number. Fibonacci series:0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597,...
  댓글 수: 2
Rik
Rik 2018년 1월 14일
Have a read here and here. It will greatly improve your chances of getting an answer.
This looks like homework. You can find guidelines for posting homework on this forum here. If I solve this for you, will I get the credit for your course?
Jan
Jan 2018년 1월 15일
While this is a typical homework question and a loop or a recursive function is accepted, the direct formula of Moivre/Binet is more efficient.
@Gurkan: I do not want to encourage you to let Google solve your homework, but did you ask an internet search engine for "Matlab fibonacci" already? Instead of this cheap solution, you post the text of your assignment without showing what you have tried so far and which problem you have.
I appreciate the polite style in the forum, e.g. that the Let me google this for you service is not suggested here. But sometimes I'm wondering if some pupils or students do not show any own effort.

답변 (1개)

ANKUR KUMAR
ANKUR KUMAR 2018년 1월 14일
fibon(41)
function S = fibon(N)
S(1)=1;
S(2)=1;
for ii=1:N-2
S(ii+2)=S(ii+1)+S(ii)
end
end
If you are using MATLAB 2016b or earlier, then make this function separately and write fibon(41) in script or in command window.
  댓글 수: 1
John D'Errico
John D'Errico 2018년 1월 14일
Please do not do their homework problems for people. This give no aid to them. It harms Answers by making it a place where kids can come and get their homework done.

이 질문은 마감되었습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by