필터 지우기
필터 지우기

Can anyone explain or show how to do this?

조회 수: 1 (최근 30일)
Brandon Morgan
Brandon Morgan 2018년 9월 28일
답변: Karun Mathiazhagan 2018년 10월 3일
Prompt the user to enter a second INTEGER number (num2) from the keyboard where 2≤num2 ≤15 and then determine how many terms in the sequence are necessary to obtain the PHI number with a precision better than 10-num2. That is, compare the absolute difference between the ratio of two consecutive numbers in the sequence (for instance 1/1, 2/1, 3/2, 5/3, 8/5, ….) with the mathematical expression for the PHI number given by to determine the number of terms in the sequence to achieve a precision better than 10-num2. Your program MUST display on the screen the number of terms in the sequence to achieve the desired precision
  댓글 수: 2
Guillaume
Guillaume 2018년 9월 28일
This looks like fairly simple homework. Which bit do you find difficult? What have you done so far?
Stephen23
Stephen23 2018년 9월 29일
@Brandon Morgan: what have you tried so far?

댓글을 달려면 로그인하십시오.

답변 (1개)

Karun Mathiazhagan
Karun Mathiazhagan 2018년 10월 3일
Hello Brandon,
The algorithm should involve evaluating the ratios of the consecutive terms and storing them in a second numeric array. The evaluation must proceed in a loop until the tolerance criterion mentioned is met. One over the size of this final second array can then be displayed after the loop terminates. This will be the number of elements of the original series used in evaluation.
I think the following MATLAB in-built functions might be of use to you:

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by