solving a sequence in matlab

4 ビュー (過去 30 日間)
HIGH
HIGH 2015 年 3 月 6 日
コメント済み: HIGH 2015 年 3 月 6 日
Ax1 = b,
Ax2 = x1
Ax3 = x2,
Ax4 = x3,
Ax = x4,
how to solve this sequence A and b are defined
A = diag(2*ones(1,n)) - diag(ones(1,n-1),1) - diag(ones(1,n-1),-1)
b = [0:1:n/2-1 n/2-1:-1:0]
  1 件のコメント
James Tursa
James Tursa 2015 年 3 月 6 日
Please explain in more detail. Does Ax1 mean A*x1, so that the line Ax1 = b means A*x1 = b and you are solving for x1? Then you use that to solve for x1, x3, x4, and ultimately x?

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

採用された回答

James Tursa
James Tursa 2015 年 3 月 6 日
編集済み: James Tursa 2015 年 3 月 6 日
Plugging everything in I get
A^5 * x = b
So the solution would be
x = A^5 \ b
However, your expressions for A and b don't seem right since the dimensions are incompatible for the linear expression. E.g.,
>> n = 3
n =
3
>> A = diag(2*ones(1,n)) - diag(ones(1,n-1),1) - diag(ones(1,n-1),-1)
A =
2 -1 0
-1 2 -1
0 -1 2
>> b = [0:1:n/2-1 n/2-1:-1:0]'
b =
0
0.500000000000000
>> A^5\b
Error using \
Matrix dimensions must agree.
  2 件のコメント
HIGH
HIGH 2015 年 3 月 6 日
編集済み: HIGH 2015 年 3 月 6 日
Thanks for the reply. Actually A and b are correct and I figured the X's out. but I need to write a function for "upper bidiagonal system" to find these X'using the attached m files. I tried couple of ways but yet having trouble writing the function.
Ohh I am sorry, n should be equal to 10.. n=10
HIGH
HIGH 2015 年 3 月 6 日
n=10 sorry

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeProgramming についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by