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

### Like this:

Like Loading...