Hi there. i have this equation | 0.99y(i+1) -2y(i) +2.01y(i-1)=0,0002 | i want i from 1 to 99. So i will have 99 equations with 99 unknowns. The first step is to make a tridiagonal matrix and store the numbers : 0.99 , -2 , 2.01 . How can i do that ?

 採用された回答

Sean de Wolski
Sean de Wolski 2011 年 5 月 25 日

0 投票

TD = full(gallery('tridiag',100,0.99 , -2 , 2.01))
EDIT Per Comment:
y = TD\B;

4 件のコメント

George
George 2011 年 5 月 25 日
great. Let's say that we have that TD. We also have the unknowns y(i), for i from 1 to 99. We also have a B 99x1 matrix with the value 0.0002 in it. How i will solve the TDy(i)=B equation ?
George
George 2011 年 5 月 25 日
next step. I am getting 50.5051 for an answer for all vallues from 2 to 98. How can i make it to see more digits ?
Sean de Wolski
Sean de Wolski 2011 年 5 月 25 日
format long
Sean de Wolski
Sean de Wolski 2011 年 5 月 25 日
It is seeing all digits (64bit floating point), you're not viewing them all...

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File Exchange で Operating on Diagonal Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by