0% found this document useful (0 votes)
88 views5 pages

Odebox: A Toolbox For Ordinary Differential Equations Boundary Value Problem: Example 1

This document demonstrates solving a classical boundary value problem of a cantilever beam with an additional support using the ODEbox toolbox. It defines the boundary value problem, generates basis functions that satisfy the constraints, sets up the differential operator, computes eigenvalues and eigenvectors, plots some results, and saves the figures. Key steps include defining nodes and basis functions, generating a differentiating matrix, constraining the basis functions, solving the generalized eigenvalue problem, and visualizing the results.

Uploaded by

imran5705074
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
88 views5 pages

Odebox: A Toolbox For Ordinary Differential Equations Boundary Value Problem: Example 1

This document demonstrates solving a classical boundary value problem of a cantilever beam with an additional support using the ODEbox toolbox. It defines the boundary value problem, generates basis functions that satisfy the constraints, sets up the differential operator, computes eigenvalues and eigenvectors, plots some results, and saves the figures. Key steps include defining nodes and basis functions, generating a differentiating matrix, constraining the basis functions, solving the generalized eigenvalue problem, and visualizing the results.

Uploaded by

imran5705074
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

ODEbox: A Toolbox for Ordinary Differential Equations

Boundary Value Problem: Example 1


Matthew Harker and Paul O’Leary
Institute for Automation
University of Leoben
A-8700 Leoben,Austria
URL: automation.unileoben.ac.at

Original: January 9, 2013


c 2013

Last Modified: June 17, 2013

Contents
1 Boundary Value Problem 1

2 tidy up the Workspace 2

3 Define the Nodes and Synthesize the Basis Functions 2

4 Generate the Differentiating Matrix 2

5 Define Constraints and Generate the Admissible Functions 3

6 Define the Linear Differential Operator for the BVP 3

7 Write Some Results to a LATEX file 4

8 Plot the Results 4

9 Save the Figures to Disk 5

1 Boundary Value Problem


This file demonstrates the solution for a classical engineering boundary value problem. It is the
example of a cantilever with an additional support.

1
ẏ(0) = 0 y··· (1) = 0

y(0) = 0 y(0.8) = 0 ÿ(1) = 0

Figure 1: Schematic of the cantilever with additional support being considered in this example.

The differential equation for the bending of the beam is,

y (4) − λ y = 0 with y(0) = 0, ẏ(0) = 0, ÿ(1) = 0, and y(0.8) = 0 (1)

2 tidy up the Workspace


1 close all;
2 clear all;
3 setUpGraphics;

3 Define the Nodes and Synthesize the Basis Functions


Define the number of nodes and the number of basis functions used.
4 noPts = 1001;
5 noBfs = 500;
Define the nodes
6 x = dopNodes( noPts, ’gramends’);
7 x = (x+1)/2;
8 %
9 % Synthesize a complete set of basis functions
10 %
11 B = dop( x );

4 Generate the Differentiating Matrix


Set up the local differentiating matrix with support length ls
12 ls = 13;
13 D = dopDiffLocal( x, ls, ls );
Generate a matrix for the second derivative
14 D2 = D * D;
15 D3 = D2 * D;

2
5 Define Constraints and Generate the Admissible Func-
tions
Define the constraints
16 c1 = zeros(noPts,1);
17 c1(1) = 1;
Find the node value closest to 0.8, this is only an approximation for demonstration purposes. In
an application requiring high accuracy a node would be placed exactly at 0.8.
18 Tinds = find( x <= 0.8 );
19 cAt = Tinds(end);
20 c2 = zeros(noPts,1);
21 c2(cAt) = 1;
Define the derivative constraints
22 c3 = D(1,:)’;
23 c4 = D2(end,:)’;
24 c5 = D3(end,:)’;
25 %
26 C = [c1,c2,c3,c4,c5];
Generate the constrained basis functions
27 Bc = dopConstrain( C, B );
Truncate the basis functions
28 Bc = Bc(:,1:noBfs );

6 Define the Linear Differential Operator for the BVP


Define the linear differential operator
29 L = Bc’ * D2 * D2 * Bc;
Compute the eigenvalues and eigenvectors.
30 [Vecs, Vals] = eig( L );
Sort the eigenvalues and eigenvectors
31 vals = diag( Vals );
32 [vals, inds] = sort( vals);
33 Vecs = Vecs(:,inds );
34 %
35 S = Bc * Vecs;

3
7 Write Some Results to a LATEX file
Write the Rayleigh-Ritz coefficients to a Latex file for documentation purposes
36 M = Vecs(1:10,1:4);
37 Mlatex = matrix2latex( M );
38 writeStringCells2file( Mlatex, ’coeffs.tex’ );

8 Plot the Results


39 setUpGraphics(10)
40 FigureSize=[1 1 10 6];
41 set(0,’DefaultFigureUnits’,’centimeters’);
42 set(0,’DefaultFigurePosition’,FigureSize);
43 set(0,’DefaultFigurePaperUnits’,’centimeters’);
44 set(0,’DefaultFigurePaperPosition’,FigureSize);
45 MyAxesPosition=[0.14 0.17 0.8 0.8];
46 set(0,’DefaultaxesPosition’,MyAxesPosition);
47 %---------------------------------------------------------------------
48 % plot the first m admissible fulctions
49 fig1 = figure;
50 plot(x, Bc(:,1), ’k’);
51 hold on;
52 plot(x, Bc(:,2), ’k-.’);
53 plot(x, Bc(:,3), ’k--’);
54 % plot(x, Bc(:,4), ’k’);
55 grid on;
56 range = axis;
57 plot( [x(cAt), x(cAt)], range(3:4), ’k’);
58 xlabel(’x’);
59 ylabel(’y(x)_{a,i}’);

0.1

0.05
y(x)a,i

−0.05

−0.1
0 0.2 0.4 0.6 0.8 1
x

Figure 2: First 3 admissible functions.

4
60 fig2 = figure;
61 plot(x, S(:,1), ’k’);
62 hold on;
63 plot(x, S(:,2), ’k-.’);
64 plot(x, S(:,3), ’k--’);
65 % plot(x, S(:,4), ’k’);
66 grid on;
67 range = axis;
68 plot( [x(cAt), x(cAt)], range(3:4), ’k’);
69 xlabel(’x’);
70 ylabel(’y(x)_{a,i}’);

0.15

0.1

0.05
y(x)a,i

−0.05

−0.1
0 0.2 0.4 0.6 0.8 1
x

Figure 3: First 3 eigenfunctions.

9 Save the Figures to Disk


71 fileType = ’eps’;
72 printFigure( fig1, ’cantileverWithSuppAddFns’, fileType);
73 printFigure( fig2, ’cantileverWithSuppSols’, fileType);

You might also like