Converting Linear Equations to Matrix Form

7 ビュー (過去 30 日間)
Connor Wright
Connor Wright 2021 年 2 月 24 日
Hello,
I am trying to convert the following equations into matrix form.
Thanks.
  1 件のコメント
Mohammadali Mozafarian
Mohammadali Mozafarian 2021 年 2 月 25 日
Hi Connor,
You wouldn't need to ask the question here. If you review your lecture notes, you will find the answer there!
Sepehr

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

回答 (2 件)

Bjorn Gustavsson
Bjorn Gustavsson 2021 年 2 月 24 日
Is k some sort of propagation (time? space?) index and you want to convert these equations into a matrix-format, or are these actually some scalilng-factors?
In case 1:
C = [C11 0 0 0;C21 C22 0 0;0 C32 C33 0;0 0 C43 C44];
ad = [a;d;0;0];
x_next = C*x_curr + ad;
In case 2:
C = [C11*k-(k+1) 0 0 0;C21*k C22*k-(k+1) 0 0;0 C32*k C33*k-(k+1) 0;0 0 C43*k C44*k-(k+1)];
ad = -[a;d;0;0];
x = C\ad;
Think I got this right, not checked or tested.
HTH
  2 件のコメント
Connor Wright
Connor Wright 2021 年 2 月 24 日
Honestly I have not been given any context what k is, just know I need to convert the equations into matrix form.
Bjorn Gustavsson
Bjorn Gustavsson 2021 年 2 月 24 日
Before you continue coding you'd better get the context! You need to know if you're implementing a stepper that intends to solve some sort of difference equation (or ordinary differential equations), or if you're supposed to get a solution for a single system of equations. Before you code something you have to know what problem you're supposed to solve.
Regardless of that I've given you solutions to the two plausible variants I could guess, from there it's your job to get the information you need to understand which one to chose.

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


Hernia Baby
Hernia Baby 2021 年 2 月 24 日
編集済み: Hernia Baby 2021 年 2 月 24 日
You need to convert following form.
X(i+1) = C*X(i) + a(i)
Xo = [0 0 0 0]';
X(:,1) = Xo;
C11 = 1;
C21 = 2; C22 = 3;
C32 = 4; C33 = 5;
C43 = 6; C44 = 7;
C = [C11 0 0 0; C21 C22 0 0; 0 C32 C33 0; 0 0 C43 C44]
step_num = 5;
a = zeros(4,step_num);
a(1:2,:) = randn(2, step_num);
i = 1;
while i <= step_num
X = C*X + a(:,i);
i = i + 1;
X
end

カテゴリ

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

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by