Obtaining the differential equations from graphical representation of the problem

33 visualizzazioni (ultimi 30 giorni)
Hi,
Is there a way to get the equations of motion (symbolic if possible) out of a graphical representation in Matla, Simulink, or Simscape?
I am curious about creating more complicated mass-damper-spring systems, work out the equations myself, and then use a method of checking to see if what I have come up with is correct.

Risposta accettata

John D'Errico
John D'Errico circa 19 ore fa
Modificato: John D'Errico circa 18 ore fa
Can you show that a set of equations is a valid representation of some data, merely by comparing them to a curve you find in some graphic, or even by comparing them to some data? Can you infer that your equations are the true model for that system? Um, no. Have you missed a term, maybe one that has only an imperceptible impact under some set of circumstances? Or, have you merely found some system that is completely incorrect, yet does a very good job of predicting what you see?
For example, a few years back (few is a relative term here) the entire world thought the universe revolved around the earth. Back in the times of Ptolemy, they even had these wonderful geocentric, epicyclic models that did a darn good job of predicting what they saw. Were those models utter crapola in terms of reality? Yes, of course they were. (Well, maybe, unless you happen to be a flat earther.)
Moving a step forwards from Ptolemaic models to Copernican ones, we saw circular motion around the sun, but it too was incorrect, even though it was not terrible at predicting how planets moved.
In fact, even now, we have models that predict motion quite well, yet are incorrect. That is, consider Newtonian motion. As long as things are moving slowly (relative to you) they predict marvelously well. Yet again, these models are insufficient to predict the behavior of relativistic systems, and are so effectively incorrect.
Stepping forward yet again, consider relativity. Is it "the "correct" model of motion under all circumstances? Well, likely not, since it too has issues when trying to predict what happens under all circumstances. (Think about what happens inside a black hole.) And even at that, sometimes our data may be suspect. (Consider the Hubble tension. Which highly accurate set of measurements are correct?)
All of these models of physical systems are increasingly better in terms of their predictive nature. But probably none of them are truly correct, and conceivably, they are all subtly wrong. Do we possibly live in an 11 dimensional universe? Even that may be just an attempt to find a model that predicts the data we see.
So can you infer a valid model of a system merely by looking at what it predicts? Of course not! I'll admit that if you start with good assumptions about how things work, and you try to use good judgement about how to put those models together, you have a chance. It is certainly true that people have been trying to infer models for all sorts of physical systems since the beginnings of time. My advisor in grad school was quite good at knowing which terms belong in a model. He had great intuition about these things. But, then Ptolemy, Copernicus, Newton, etc., were all smart people too.
  1 Commento
Andrew
Andrew circa 3 ore fa
Hi,
Wow, thanks for that answer. We must also not forget what belief system we work in.
The model and equations come from Basics of Analog Computers by T.D Truitt and A.E Rogers 1960.
Recently I was informed that I could use:
[Sum of impedances for forces due to motion of m1]*X1(s) - [Sum of impedances for the interaction force between m1 + m2]*X2(s) = [Sum of applied forces on m1]
-[Sum of impedances of interaction forces between m1 + m2]*X1(s) + [Sum of impedance forces due to motion of m2] *X2(s) = [Sum of applied forces on m2]
to get these equations.
Can I use that in mbk1 + mbk2 + mbk3 + mbk4 + mbk5....etc sysems? I'd like to find out.
It seems the publisher of the book has a black hole on the mind:

Accedi per commentare.

Più risposte (1)

Paul
Paul circa 16 ore fa
One can implement the equations of motion in Simulink and then use linearize to get the differential equation, but that requires numerical values for parameters in the problem.
Simscape Multibody might be an option has it allows one to construct the system graphically more like the picture in the question using a Prismatic Joint for the spring/dashpoint and an Inertia block for the point masses. linearize should then yield the equations of motion for the specified numerical parameters. At least I think that should be workable; I freely confess to having no practical experience with Simscape Multibody.
I'm pretty sure that the only option for a symbolic solution is to use the Symbolic Math Toolbox. For the problem shown, I believe one could implement, by hand, the force balance equations for the four masses and then use odeToVectorField to get eight, first-order, coupled equations.
However, it sounds like you're looking for a generalized, automated, approach. I think, but could be wrong, is that one could develop a framework in which point mass, spring/dashpot, and external force (and maybe ground?) can each be represented by some sort of object, and then have a defnition of connectivity between realized objects, and then form the actual system by carrying out the connections based on the connectivity. Such an approach sounds very similar in spirit to how connect works in the Control Systems Toolbox. It actually might be an interesting project to implement something similar for this problem (and it would definitely be of interest to implement connect() functionality for LTI systems defined symbolically based on previous questions on this forum, though not so much recently).
Thinking about it a bit more, maybe the problem is not as complicated as I've made it out to be. Is it not the case that any mass/spring/damper system can be represented by the matrix equation
M*xddot + D*xdot + K*x = F
If so, then one only needs a description of which which spring dampers are connected between elements or ground to fill out the D and K matrices, and which elements have external forces (or just leave F as a full n x 1) for generality.
  2 Commenti
Paul
Paul circa 10 ore fa
Modificato: Paul circa 10 ore fa
Example code for the example in the question
clearvars
syms M [4,1]
syms F [4,1]
Finternal = zeros(4,1,'sym');
syms t
x = formula(symfunmatrix2symfun(symfunmatrix('x(t)',t,[4,1])));
% make the connections matrix as complicated as needed. Can have
% multiple connectors between the same two mass elements.
% Use a cell array for growth to the case where a connector can be
% connected to ground on one side.
connections = {[1,4];[2,4];[3,4]};
K = sym('K',[numel(connections),1]);
D = sym('D',[numel(connections),1]);
for ii = 1:numel(connections)
c1 = connections{ii}(1);
c2 = connections{ii}(2);
C = -K(ii)*(x(c1)-x(c2)) - D(ii)*(diff(x(c1))-diff(x(c2)));
Finternal(c1) = Finternal(c1) + C;
Finternal(c2) = Finternal(c2) - C;
end
sympref('AbbreviateOutput',false);
eqn = M.*diff(x,t,2) - Finternal == F
eqn = 
This approach would need to be modified a bit if an element can be connected to a spring/damper that's connected to ground on the other side. I don't think that would be too hard of a modification.

Accedi per commentare.

Prodotti


Release

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by