Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

Numerical Integration -Matlab

Status
Not open for further replies.

MegaStructures

Structural
Sep 26, 2019
366
0
0
US
Does anybody know how to numerically integrate the following formula in Matlab?

C09AAC61_iummdt.png


“The most successful people in life are the ones who ask questions. They’re always learning. They’re always growing. They’re always pushing.” Robert Kiyosaki
 
Replies continue below

Recommended for you

Yes, but I usually do that specific job in Excel, because you have to do each time step in order to feed the results through to the next time step. You can certainly do it in Matlab. I don't use the built in diff equations solvers because all of my problems are non linear and have step functions in (contact problems).

You need an initial condition for theta and a time history for P, which appears to be the independent variable. The brute force approach then looks like this.

%set up initial conditions
m=
g=
P= %a single column vecotr
theta0=
dt=
%and so on

%get some vectors preallocated
L=size(P)
t=0*P
x=t;
y=t
theta=t;
%and so on

%initialise t=0 conditions into first row
theta(1)=theta0;
%and so on

%main loop
for ii=2:L
t(ii)=t(ii-1)+dt;
%work out accel using previous time step and new P
%work out vel using previous time step and new acc
%work out theta using previous time step and new vel
%tidy up
end






Cheers

Greg Locock


New here? Try reading these, they might help FAQ731-376
 
Hey Greg:

I’d much rather use excel. I know how to use Newmarks method for a certain second order differential equation, but it’s unclear to me if the same variables can be used for this equation.

Would you be willing to help me get started with this in excel?

“The most successful people in life are the ones who ask questions. They’re always learning. They’re always growing. They’re always pushing.” Robert Kiyosaki
 
Thanks Greg. This looks much easier than I was expecting. What is the significance of the 1 and 10 at the top of your spreadsheet?

“The most successful people in life are the ones who ask questions. They’re always learning. They’re always growing. They’re always pushing.” Robert Kiyosaki
 
The spring rate is exactly where I run into problems.

For my problem above the resisting force is function of theta yet most numerical method examples I've seen have had the "k" term as a constant.

“The most successful people in life are the ones who ask questions. They’re always learning. They’re always growing. They’re always pushing.” Robert Kiyosaki
 
Extra vectors as in an extra column of values for "k" that updates with each updated in t. Similarly to x, v, and a in your spreadsheet?

“The most successful people in life are the ones who ask questions. They’re always learning. They’re always growing. They’re always pushing.” Robert Kiyosaki
 
I think I am way over complicating this, feel like I'm close, but not quite there.

How I'm seeing this really is is a series of algebraic equations.

At step t=0: F=(some value), acceleration=0, theta=0 --> instability occurs
At step t=0.001: correct for instability, what progresses first to facilitate the solving of the rest of the variables?

I must have to assume the progression of either rotation, or rotational acceleration to get to step 2, since there are two unknowns?

“The most successful people in life are the ones who ask questions. They’re always learning. They’re always growing. They’re always pushing.” Robert Kiyosaki
 
Hmm I’m not sure that’s true, because I have two unknowns. Theta affects the acceleration, because as the bar rotates the weight acts against the forcing function at a greater magnitude. If the bar was massless I would know acceleration from F.

Maybe this is why Newmarks terms are necessary

“The most successful people in life are the ones who ask questions. They’re always learning. They’re always growing. They’re always pushing.” Robert Kiyosaki
 
Hi, I was interested to see this because I use a method here to solve similar 2nd ODE for power electronics,
transient electromagnetic and transient thermal applications.
The approach dates back 50 years when analog computers had patch panels .
Users would draw a block diagram just by inspection of the ODE and its auxiliaries, ready to patch it up.

Analog computers are extinct, but I found the block diagram method to be quick and useful.
I also use circuit simulators and FEM suite , but found some applications are better solved using this method.
The hardware is replaced by coding the function blocks (in this example,Python3).

Although the old analog computers could not solve a Partial DE (PDE),
I have used a similar method to solve PDE by equating (for example) a spatial finite differencing to an integrator in time.

The screenshots below are shown just as an example of the method using an approximate interpretation of MegaStructure's diagram.
Constants and initial conditions are not correct.

Block Diagram from ODE and aux functions.:
Python:
Results:
 
Status
Not open for further replies.
Back
Top