Help with Difference Equation in MATLAB
Mostrar comentarios más antiguos
Hi, all
I have a structural engineering book dated back at 1979 that presents a fairly odd equation to compute rotations at member joints.
This is:

Where C, V , h and K are constant properties. Theta is the joint rotation at the level considered, the level above and the level below (hence the subscript).
The book mentions a several ways of solving it. One being iteration procedures. It also refers to this equation as a difference equation, which I have no experience with at all. Although I have read that they are fairly similar to differential equations which i have some experience with.
My question is, is there a function or command in MATLAB that could be employed to solve this equation? Like there is for differential equations symbolically and numerically. And could somebody help me with this?
Many thanks,
Scott
3 comentarios
Scott Banks
el 17 de Ag. de 2025
Movida: Star Strider
el 17 de Ag. de 2025
(18) defines a linear system of equations with a tridiagonal coefficient matrix. This is confirmed by what is written in the first paragraph of 5.2 .
The paper is very old - thus solution of linear systems of equations was not standard at the time when it was published.
So if you write the equations in the form
A*theta = b
with A being a 8x8 coeffient matrix, b being a 8x1 vector and theta = [theta(1);...;theta(8)] being the solution vector and solve for theta as
theta = A\b
you will get your solution.
I did this for the equations you formulated. So if they are correct, you are done.
If you want to call (18) a recurrence relation, you can do this. The solution of this recurrence is done by solving a linear system of equations.
Scott Banks
el 19 de Ag. de 2025
Respuesta aceptada
Más respuestas (1)
John D'Errico
el 16 de Ag. de 2025
0 votos
Since V_i and h_i appear to vary with the index i, there is no analytical solution. (If V and h were constants, not changing with subscript, then an analytical solution will exist, and indeed, it would be not unlike the solution of a second order ODE.)
However, you can simply write a loop. You MUST know theta_0, and theta_1. Rewrite the equation, isolating theta_(i+1) on the left hand side. Now everything is known. Just compute the value of theta_(i+1) iteratively. This is no different from computing the Fibonacci numbers. Start at the beginning, and just write a loop.
If V and h are actually fixed, scalar constants that do NOT vary with the index, then the problem does indeed have a solution, and there are multiple ways you can solve for theta in an analytical form. But I won't go into the depth of explaining the solution for a case that I don't think exists at this time.
5 comentarios
Scott Banks
el 16 de Ag. de 2025
John D'Errico
el 16 de Ag. de 2025
No. You don't understand. If V varies, across each level, then there is no analytical solution. Only if V has the same value for EACH level, can you find a simple analytical solution.
You have said that h is the same for each, but you have stated that V does vary. That it varies in a simple way, at least in your example, might possibly help.
Just use a loop!
Scott Banks
el 17 de Ag. de 2025
This is a basic Gauss-Seidel iteration scheme. As you have wrritten it, if I recall properly, it will converge if the corresponding matrix probem is diagonally dominant. That is, you will need
1 > abs(C/KGM) + abs(C/KGt)
So what do you have?
E = 2.0E+08;
I = 1.07E-03;
h = 3;
A = 0.0206;
C = 1/2*4*E*I/h;
G1 = E*(2*I/5 + I/3)*13;
Q = 15;
KGm = 6*G1 + C + C;
KGt = 6*G1 + C;
Now, what are the ratios C/KGm and C/KGt?
C/KGm
C/KGt
Which means the iteration scheme you propose will be (fairly rapidly) convergent. As easily however, Torsten also showed how to solve the problem using backslash.
Categorías
Más información sobre Eigenvalue Problems en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


