Converting Linear Equations to Matrix Form

조회 수: 5 (최근 30일)
Connor Wright
Connor Wright 2021년 2월 24일
댓글: Mohammadali Mozafarian 2021년 2월 25일
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 CenterFile Exchange에서 Logical에 대해 자세히 알아보기

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by