×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Numerical Integration -Matlab

Numerical Integration -Matlab

Numerical Integration -Matlab

(OP)
Does anybody know how to numerically integrate the following formula in Matlab?

“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

RE: Numerical Integration -Matlab

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: Eng-Tips.com Forum Policies http://eng-tips.com/market.cfm?

RE: Numerical Integration -Matlab

(OP)
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

RE: Numerical Integration -Matlab

(OP)
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

RE: Numerical Integration -Matlab

(OP)
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

RE: Numerical Integration -Matlab

(OP)
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

RE: Numerical Integration -Matlab

(OP)
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

RE: Numerical Integration -Matlab

(OP)
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

RE: Numerical Integration -Matlab

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.:
https://app.box.com/s/logqmbimuykbr9racaavw2ab39uf...
Python:
https://app.box.com/s/t64dqh1zjd2rwro1rghywsry0mnp...
Results:
https://app.box.com/s/mtk0fdntu51vvzti0y38hryiadak...

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members! Already a Member? Login



News


Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close