Numerical Methods Problem Solution

조회 수: 3 (최근 30일)
Chijioke  Nkwocha
Chijioke Nkwocha 2021년 5월 15일
댓글: Chijioke Nkwocha 2021년 5월 15일
Can i please get help with this question? I am new to MATLAB and do not know how to go about solving this in MATLAB, maybe i would be able to solve subsequest problems when i see the steps to this question. Thanks.
  댓글 수: 4
Dyuman Joshi
Dyuman Joshi 2021년 5월 15일
Fair enough, I'll give you an outline of the code so you can work with it. In case you have any queries, do mention.
Chijioke  Nkwocha
Chijioke Nkwocha 2021년 5월 15일
I was able to come up with a code for the aforementioned problem, but i doubt it is right. Any idea to make it better?

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

채택된 답변

Dyuman Joshi
Dyuman Joshi 2021년 5월 15일
편집: Dyuman Joshi 2021년 5월 15일
In MATLAB, indexing start with 1 and not 0 (as it does in some programming languages).
%defining the initial values
t0 = 1/sqrt(3);
t = (sqrt(t0^2+1)-1)/t0;
pi_approx = (sqrt(t^2+1)-1)/t;
for i=1:24
t(i+1) = (sqrt(t(i)^2+1)-1)/t(i);
pi_approx(i+1) = 6*2^i*t(i+1);
end
%converting to table
y=array2table([t;pi_approx]', 'VariableNames',{'t','pi_approx'});
  댓글 수: 5
Dyuman Joshi
Dyuman Joshi 2021년 5월 15일
I have edited my answer, check it.
Chijioke  Nkwocha
Chijioke Nkwocha 2021년 5월 15일
Thanks.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

태그

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by