# Matlab and Visual Basic Programming

For the first part you have to design a program on Matlab (see file for details)

Part b is on visual basics (under same zip file) read details

thanks

## Deliverables

**Part A

1. Introduction:**

Problem ananlysis and requirements specification (10%)

Design of the solution (20%)

Program implementation (with comments to aid

Understanding) (30%)

Testing for correct operation (10%)

You must write a report which contains a listing of your program as well as

an account of how you followed the five stages of the development. The

report must include a Group Member Assessment Form which clearly

shows the level of contribution of each member of the group.

(30%)

Your report and Visual Basic program (using VB2010 and provided on a virus

free CD)

**2. Description of the Problem **

A sign post is supported by a hollow circular pole as shown in Figure A.

The principal stresses and maximum shear stresses at points A and B at

the base of the pole have to be determined for various design dimensions

and wind pressure against the sign.

The circular pole has the outer and inner diameter of d1 and d2

respectively. The sign is offset from the centreline of the pole by an

amount of O. The lower edge of the sign is at height of h above the

ground. The dimensions of the sign is a x b. The wind pressure p against

the sign produces a resultant force that acts at the mid point of the [url removed, login to view] this project you will solve this problem through the development of a

program where data is entered with the help of a graphical numerical

keyboard designed and implemented by you, not through a physical

keyboard. The dimensions a and b of the sign should be entered through

two textboxes with the graphical keyboard. The other dimensions d1, d2,

O, h and the wind pressure p on the sign may either be entered through

the text boxes or selected from combo/list boxes. A series of control

buttons may be used to direct data from the graphical keypads to the

various textboxes.

Once the dimensions are entered, a command button should activate the

process of calculating the stresses. The program should be structured with

the use of at least one user defined Sub Procedure or Function Procedure

in it. Results of the various stages of calculations may be presented either

in textboxes or with message box. Final results should be displayed in a

snumber of textboxes or on labels.

NOTE: Wind pressure against a sign is a worked out problem (Example 8-

6) in the following two books available in the RV library:

"Mechanics of Material"; J.M. Gere; Thronton 6

th

edition; ISBN

0495073075

"Mechanics of Material"; [url removed, login to view] and B.J. Goodno; CENGAEGE

Learning; 7

th

edition; ISBN 049538076

**PART B**

1. Introduction

Problem analysis (10%)

Design of the solution (10%)

Program implementation (with comments to aid understanding) (50%)

Testing for correct operation (10%)

You must write a report containing the listings of your programs as well as an account of

how you followed the software engineering method. The report must include a Group

Member Assessment Form which clearly shows the level of contribution of each member

of the group. (20%)

**2. Description of the Problems **

Assignment 1: Natural frequencies of a bridge

Bridge response under the action of a force depends on the characteristics of the

bridge and the load applied. The key bridge parameters are the mass of the bridge,

the length of the span and the natural frequencies of the bridge. Resonance appears

when the frequency of the loads corresponds to or is a multiple of a natural

frequency of the structure. The vibration displacements of the structure is strongly

amplified when resonance occurs.

Consider the following bridge as shown in Fig 1.

Fig. 1: Schematic of the bridge

Here we will model our bridge by a system of three masses and four springs. The

corresponding linear system ???? = ???? has coefficient matrices.?? =

??1 0 0

0 ??2 0

0 0 ??3

?? =

&minus; ??1 + ??2

??2 0

??2 &minus; ??2 + ??3

??3

0 ??3 &minus; ??3 + ??4

The equations of motion of the system are expressed as

?x? ? Ax where

?

?

?

?

?

3

2

1

x

x

x

x and A= M-1

?x? ? Ax where

?

?

?

?

?

3

2

1

x

x

x

x and A= M-1

K .

The period, T, of natural vibration is given by

?

?

?

?

2

T where &lambda; are the eigenvalues of the matrix A.

1. Write a Matlab program, i.e. an .m file that include the following functionalities:

a. To enter the masses and spring coefficients of the bridge.

b. To construct and display matrix A

c. To compute the eigenvalues &lambda;1, &lambda;2 and &lambda;3 of the equations of motion of

the bridge.

d. Find the periods of the oscillations T1, T2 and T3 and then find the

natural frequency of each oscillation.

e. Construct three sinusoidal signals, each having the frequency fi, i=1, 2,

3 and call the signals S1, S2 and S3 respectively.

f. Plot the following signals:

i. S1

ii. S2

iii. S3

iv. S1 + S2+ S3

First, each plot on each figure window, and then combine the three

plots on one figure window. Then complete the labelling of the figures.

2. Present the testing results of running the program for values of masses and

spring stiffness.

3. Write an analysis about the system based on the results you observe in the

simulation. Remember that what you are simulating is a system of a three

Hints:

1. You may use the command input to enter the elements of the matrix A

2. The eigenvalues, &lambda;i, of the matrix A are the roots of the equation

det(A-&lambda;I)= |A-&lambda;I|=0, where I is the identity [url removed, login to view] 2

Develop a children's program where a set of six numbers generated at random will

be presented on the screen when a set button is clicked. The child will then attempt

to select the numbers in ascending order by clicking on the numbers one at a time.

Each time a number is selected it will be copied on a different part of the screen for

later comparison. Finally, when the child clicks on a check button, the six numbers

originally presented will be rearranged according to the ascending order and

depending on the accuracy of the child's effort reward him/her with an appropriate

message

---------------- End of Small Group Assignment -------------------

Skills: PHP, XML