Converting Linear Equations to Matrix Form
7 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hello,
I am trying to convert the following equations into matrix form.
Thanks.
1 comentario
Mohammadali Mozafarian
el 25 de Feb. de 2021
Hi Connor,
You wouldn't need to ask the question here. If you review your lecture notes, you will find the answer there!
Sepehr
Respuestas (2)
Bjorn Gustavsson
el 24 de Feb. de 2021
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 comentarios
Bjorn Gustavsson
el 24 de Feb. de 2021
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
el 24 de Feb. de 2021
Editada: Hernia Baby
el 24 de Feb. de 2021
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 comentarios
Ver también
Categorías
Más información sobre Logical en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!