Converting Linear Equations to Matrix Form
7 次查看(过去 30 天)
显示 更早的评论
Hello,
I am trying to convert the following equations into matrix form.
Thanks.
1 个评论
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
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 个评论
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
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
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!