## Matlab

### Continuous Beam Analysis - General

This is a general beam analysis program. It uses the stiffness method to determine the rotations at each support. These are then used to determine the member end forces. Exact expressions are then used to determine the distribution of shear, moment, rotation and deflection along each member. The program features:- Multiple load types: point load; uniformly distributed load; patch load, and; moment load;
- Spring supports, both vertical and rotational, enabling it to be used as part of a subframe analysis;
- Results are output at 100 positions along each span, enable accurate deflection estimation.

*CBA showing a subframe analysis*

### Continuous Beam Analysis - Envelope

This is an extension to the general beam analysis program. It automatically patterns applied loading to obtain envelopes of maximum and minimum load effects. The user can specify the maximum and minimum dead and live load factors. Note that the files for CBA-Env must be put in the same folder as CBA. Note that Section 15 of the GNU GPL, Disclaimer of Warranty, and Section 16, Limitation of Liability, are particularly pertinent to this engineering design program. Source (2 KB)*CBA-Env showing 4-span beam analysis*

### Continuous Beam Analysis - Bridge

This is another extension to the general beam analysis program. It allows the user to pass the following forms of load across a bridge:- knife-edge loads;
- HB vehicle;
- Special convoy vehicle.

- moment and shear envelopes;
- maximum and minimum moment against position of first axle;
- bending moment diagrams when maximum and minimum moments occurred;
- a report of maximum and minimum load effects for any chosen point of interest.

*CBA Bridge showing typical output*

### Section Properties Calculator

This is a short but really useful script that calculates the section properties for an arbitrary shape with holes. Source (2 KB)*SecProp showing footbridge*

### Prestressed Concrete Design

A collection of scripts for prestressed concrete calculations. Features include:- Magnel diagrams;
- Stress checks at critical sections;
- Minimum section modulus calculations;
- Cable zone calculations.

*PSC showing ongoing design of continuous prestressed concrete beam*

## Comments

**Comment** from **Colin**

**Time:** 23 January, 2009, 01:09

You’re right: that is a very serious problem. I suggest studying some books to find the equations that describe the stress resultants you’re looking for. Then, use a computer program like MS Excel or Matlab to plot the equations. You may have to study some other books to learn how to do that too though. However, I’m sure all this reading won’t put you off. Best of Luck!

**Comment** from **ugo**

**Time:** 2 February, 2009, 15:58

HMD i have a program that can do just that for u, but as my site is still under construction now, u’ll v to contact me via my e-mail, ugoelumeze@whoever.com

i’ll be glad to hear from u.

**Comment** from **moon**

**Time:** 2 June, 2009, 08:58

dear sir,

thank u for ur sources, I think they are the exact things I need.

but since I am not good at Matlab, I don`t know how to run the function CBA.

I think I have set path to the unziped file, but still failed to run it.

could you send me an example to help me understanding how to use ur sources?

for example, consider a cantilever beam (or simple supported beam) subjected to a force P at the tip.

how could I input the paraments?

sorry for my rude require, I really need ur help.

BTW, my e-mail: moon555sss@hotmail.com

**Comment** from **pierrot**

**Time:** 11 September, 2009, 17:09

dear mr. caprani,

your continuous beam application is a real nice piece of work, i like it very much. that made me translating it into c++. today i put it into sourceforge (http://sourceforge.net/projects/cbeam/) to share with others, i hope you dont mind.

greetings from germany, pierrot.

**Comment** from **Admin**

**Time:** 11 September, 2009, 23:54

Pierrot,

I don’t mind at all – I think it is a very nice complement, so thank you. I’m glad that someone has used it and has liked it. Well done for putting the work in too!

I’ve had a look at your code and it is very clean and clear – I’ve learned a lot from it, so thank you. Let’s hope other people find it useful too.

Colin

**Comment** from **Ali El-baden**

**Time:** 2 January, 2010, 22:15

Dear Prof colin

I find your web site very useful, and I wish that you publish your structural analysis notes in a kind of a book , best wishes and happy new year.

Greating from Tripoli-Libya

**Comment** from **eng-zarzour**

**Time:** 19 March, 2010, 08:43

I’m now developing a new program about Prestressed Concrete for my Master degree , and i really enjoy to learn some concepts from your program , thanks a lot >>>> , for help about Matlab : i recommend this e-book “MATLAB Codes for Finite Element Analysis.pdf” for civil engineers ,for contact my email : spade-hero@hotmail.com

**Comment** from **jock**

**Time:** 30 March, 2010, 16:34

can you give me some example that use those *.m file. I’m waitting for u!

**Comment** from **jock**

**Time:** 30 March, 2010, 17:03

Sorry to trouble u. I’ve got the ex. thank’s a lot

**Comment** from **Raim**

**Time:** 26 May, 2010, 03:50

Hi, may I know if the CBA function can be used for a beam which has one support only at the end? I have found the function very useful for beams with support at either end, and kudos for that! But please enlighten me on this issue.

Thank you

**Comment** from **Admin**

**Time:** 26 May, 2010, 13:46

Raim,

Once you have specified enough boundary conditions to the make the beam stable, it should work fine. If it is a support at only one end then it must be a fixed support (or at least have sufficient spring support stiffnesses to prevent large rigid body motions). Make sure both translation and rotation are prevented as a first step.

Colin

**Comment** from **wahyoe**

**Time:** 20 June, 2010, 08:37

how to use make source

**Comment** from **Dave**

**Time:** 15 January, 2011, 22:19

Hi

Thanks very much for this nice introduction to matlab and stiffness method. I enjoy it.

But… If I create a double-span beam, everything looks right. When I kill the middle support by setting

R = [-1,0,0,0,-1,0]

I’d assume to get a single-span beam. Moments ans Shear-Force are looking okay, but the deflection seems a bit … uh … strange.

Looking closely, there seems to be something wrong with the deflection near a support, even the ending supports: there is a change of direction, in which the curve is bent. (Excuse my technical english, please). I’m not sure, if this happens in a «normal single span», too. The change to see it on the deflection-curve is too small.

But, again. Thanks a lot.

~dave

**Comment** from **Admin**

**Time:** 18 January, 2011, 17:17

Dave,

Very good spot – I’ve looked into it and the calculation for deflection is definately putting out something that’s not correct! The stiffness calculations are fine (e.g. the d of line 64, CBA.m), put in post processing for deflections along the member there is some error. It’s not jumping off the screen at me so I will have to take more time at it. I’ll post up a fix soon.

Thanks for that!

Colin

**Comment** from **Admin**

**Time:** 20 January, 2011, 21:12

Dave,

Looking into this a bit further, CBA works fine when used as originally intended when it uses one ‘element’ per span. When you removed the central support, you made a single span with two elements. I agree though that this should be possible and so I have a fix that will enable this to be used:

1. in the file mbr_values.m, delete (or comment out) the lines:

d = d + disps(1).*((2/L^3).*x.^3 – (3/L^2).*x.^2 +1); % end displacements

d = d + disps(3).*((-2/L^3).*x.^3 + (3/L^2).*x.^2);

2. In their place, insert the following:

h = L/npts;

Ri = disps(2);

di = disps(1);

R(2:npts+2) = cumtrapz(M(2:npts+2))*h/(E*I) + Ri;

d(2:npts+2) = cumtrapz(R(2:npts+2))*h + di;

This is using the moment area method to solve for the displacements instead of displacement functions. It will give the same results as previous for single-element spans, but unlike the previous code, will work when more than one element is used to represent a span.

Hopefully you find it helpful.

**Comment** from **Dave**

**Time:** 23 January, 2011, 17:09

Dear Collin

Thanks a lot for that quick answer. You know, I’m just a, let’s say, «normal» engineer. I was looking around to find some Information about how to programm something like cba. (And found your page coming from sourceforge.net.) We’re planning a lot of excavations. A state of the art static-software ist normally like shooting with tanks on sparrows for the calculations we need.

So, I was just doing some checks to see, if your code would do, what I expected, and found the result above.

Thanks a lot, that was very helpful. I’m gonna try, if/how I can use it for my daily work.

Yours, dave

**Comment** from **Sebastian**

**Time:** 20 September, 2011, 17:26

Hi,

Thanks for your useful site and to share all with us.

I have a quiestion. My english is not the best, I hope that you understand me!

How can I put a partial triangular ascending load? I’m trying in your Matlab program and in the c++ aplication made by Pierrot. In the Matlab program I don’t know how to put that kind of load (triangular load), and in the c++ aplication, I can put a partial triangular descending load, but not the ascending load.

Thanks a lot!

Sebastian

**Comment** from **Admin**

**Time:** 20 September, 2011, 18:32

Sebastian,

Your English is very good! I did not include the ability to apply this form of load in the program. Pierrot has included the ascending type only. You can try to include the load in either the Matlab or C++ version yourself if you know programming and the theory (and if you can follow the code). Otherwise you could try a freeware program like LinPro (http://www.line.co.ba) which is really good and easy to use.

Hope that helps,

Colin

**Comment** from **Pierrot**

**Time:** 30 November, 2011, 17:27

Sebastian,

a partial triangular ascending load is included in the c++ application, just use a negative value for the load length.

Kind Regards,

Pierrot

**Comment** from **Amir**

**Time:** 6 February, 2012, 22:49

dear sir,tnx for ur good website.I need matlab codes for n-span beam to calculate any tyeps of loading such az disterbuted loading and its gives us deflection,interal force, shear ,reflection, and moment in supports for any type of loading,tnx for your responce

**Comment** from **Admin**

**Time:** 6 February, 2012, 23:49

It is above.

**Comment** from **Sahil mujawar**

**Time:** 15 June, 2012, 07:47

Sir do you have programming steps for RC design of Structural elements using MATLAB or MATCAD.

Best Regards,

SAHIL MUJAWAR

**Comment** from **Arun**

**Time:** 16 June, 2012, 07:24

Nice and interesting web site. Most interesting and enjoyable part being the nice reply for comments.

**Comment** from **Somdatta**

**Time:** 28 June, 2012, 07:18

Sir can u plz give me idea abt writing a matlab program for calculating the displacements and member forces of a 3d truss.

**Comment** from **anabolic uk**

**Time:** 4 August, 2012, 17:38

Hey I know this is off topic but I was wondering if you knew of any widgets I could add to my

blog that automatically tweet my newest twitter updates.

I’ve been looking for a plug-in like this for quite some time and was hoping maybe you would have some experience with something like this. Please let me know if you run into anything. I truly enjoy reading your blog and I look forward to your new updates.

**Comment** from **M.Vigna**

**Time:** 25 August, 2012, 03:50

Great work. Thanks a lot for your time and energy.

**Comment** from **Mike**

**Time:** 17 January, 2013, 03:58

Firstly, thanks for your efforts with this program. In regards to your response to Dave on 20 January, 2011 about the fix for the calculation of deflection, it still does not appear to provide the correct results when a span end is free, even for a single span. Is this a limitation of the method or is modification needed to make a free-fixed (R = [0,0,-1,-1]) condition work? Thanks.

**Comment** from **learner**

**Time:** 23 February, 2013, 08:33

Hi Prof,

i tried this cba (Peirrot’s version) and compare moment results with SAP2000, by modelling a 5 span uniformly loaded. I notice 10% differences in result. Is it suppose to differ in both programs. Thanks

**Comment** from **john**

**Time:** 13 March, 2013, 18:35

hello good, I’m John, I would like to know because everything realizastes and how do I make it run the program, I get

??? Attempt to execute SCRIPT as a function Contents:

C: Program Files MATLAB R2009a toolbox matlab general Contents.m

Thanks for your help.

**Comment** from **Samir Kulkarni**

**Time:** 17 September, 2013, 20:58

Hello Sir,

I am beginner ,I just started coding in MATLAB,I completed many codes for single spans,but I just started on continuous beam analysis but I don’t know how to do that,I saw your code for CBA but I am not getting how to implement it and run,I want to learn how to do this,please give me some guidelines to make this program run,and to code more programs for continuous beams.

waiting for reply.

thanking you.

**Comment** from **Andrea Federigi**

**Time:** 13 August, 2015, 01:26

Dear sir, I thank you for the codes. I study a little and I have some commerction to submit to your attention, special for CBA, where I found some mistakes. Some of them are not really important, but improove the code speed. In the mean time I have some dubt over blending moment where is a strange peack over the appication point. Can I sending you my corrections?

CommentfromHMDTime:23 January, 2009, 00:45Hi.

Thanks for your useful site.

i have a serious problem and i think you can help me.actually i need a program which can plot shearing stress and bending moment diagram for a beam.this beam can be under a point load or uniformly distributed load(rectangular and triangular)

i need this program as soon as possible.please help me if you can.

with the best thanks.