Matlab Tips

This script demonstrates a Matlab anonymous function with variable coefficients. It also performs integration using the quad function, which uses adaptive Simpson quadrature. This example is from an actual engineering problem for beam vibration.

L=27.5;
beta=4.73004/L;
%
sigma1=( sinh(beta*L) +sin(beta*L))/(cosh(beta*L) -cos(beta*L));
%
core=@(x) ((cosh(beta*x)-cos(beta*x))-sigma1*(sinh(beta*x) -sin(beta*x))).^2;
%
quad(core,0,L)

* * *

Here is a script for reading ASCII text data into Matlab:  read_data.m

The data should not have any header lines.  It should also have a uniform number of columns.

* * *

– Tom Irvine

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s