Post on 24-Feb-2018
7/25/2019 Structural Analysis Lecture No.1
1/27
Structural AnalysisMSc-YEAR 2015
by
DR. IFFAT SIDDIQUE
7/25/2019 Structural Analysis Lecture No.1
2/27
Introduction Introduction of Students
Introduction of Subject
Introduction of Teachers
7/25/2019 Structural Analysis Lecture No.1
3/27
Reference Books The Finite Element method using MATLABYoung W.
Kwon & Hyochoong Bang
Matlab Code for Finite Element AnalysisA.J.M. Ferreira
Essential MATLAB for engineers and ScientistsBrain
Hahn & Dan Valentine
www.mathworks.com/support/bookslist of Matlab and
Simulink based books
www.matworks.cominfo about MathWorks products and
their use
7/25/2019 Structural Analysis Lecture No.1
4/27
What is MATLAB? MATLAB stands for matrix laboratory
Originally written to provide easy access to matrix
software developed by the LINPACK and EISPACK
projects which are now a part of it
Widely used in engineering, mathematics and
sciences
Why?
7/25/2019 Structural Analysis Lecture No.1
5/27
Typical Uses
Mathematical computation
Algorithm development
Data acquisition
Modeling, simulation, and prototyping Data analysis, exploration, and visualization
Scientific and engineering graphics
7/25/2019 Structural Analysis Lecture No.1
6/27
Getting Started With MATLAB installed
Open up your MATLAB
Through START menu
7/25/2019 Structural Analysis Lecture No.1
7/27
MATLAB Desktop
7/25/2019 Structural Analysis Lecture No.1
8/27
Command Window: Where you enter commands
Command History: running history of commands
which ispreserved across MATLAB sessions
Current directory: Default is $matlabroot/work
Workspace: GUI for viewing, loading and savingMATLAB variables
Editor/Debugger: text editor, debugger; editor workswith file types in addition to .m (MATLABm files)
7/25/2019 Structural Analysis Lecture No.1
9/27
Making Folders
7/25/2019 Structural Analysis Lecture No.1
10/27
Customization
7/25/2019 Structural Analysis Lecture No.1
11/27
Help/ Doc
>> lookforkeyword search to search for a particular string in Help
text of functions
>> demo for a demonstartion program
7/25/2019 Structural Analysis Lecture No.1
12/27
ScriptsOverview
7/25/2019 Structural Analysis Lecture No.1
13/27
Scriptsthe Editor
7/25/2019 Structural Analysis Lecture No.1
14/27
ScriptsSome Notes
7/25/2019 Structural Analysis Lecture No.1
15/27
Quitting MATLAB To end your MATLAB session
File -> Exit MATLAB in the desktop
OR Type
quit / exit in the command window
7/25/2019 Structural Analysis Lecture No.1
16/27
Arithmatic To sum up x + y
Subtraction x - y
Multiplication x * y Division x/ y
x\ y
Exponent x ^ y
Try with: x=2, y=3
7/25/2019 Structural Analysis Lecture No.1
17/27
Operators Precedence
7/25/2019 Structural Analysis Lecture No.1
18/27
Operators Precedence
7/25/2019 Structural Analysis Lecture No.1
19/27
Variables Assign variables to do the arithmetic operations
To use the result in further calculations
>> a=2
>> a= a+7
>> a=a*10
>> b=3
>> z=a+b
NOTE: In the last case the latest result is saved in a variable Ans replacing theresult of the previous calculation.
Semicolon
7/25/2019 Structural Analysis Lecture No.1
20/27
Variable Names It may consist only of:
- Letters from a-z
- Numbers from 0-9- underscore ( _ )
It must start with a letter
NOTE: MATLAB is case sensitive
7/25/2019 Structural Analysis Lecture No.1
21/27
Mathematical Functions MATLAB has all of the useful mathematical functions.
>> x=4;
>> sqrt(x)
>> sin (x) excepts x in radians[Syntax 4 sin(90): sin(90*pi/180)
>> cos(x)
>> log (x)
>> exp(x) exponential function ex
>> pi*x
NOTE: whos , clear, clc
7/25/2019 Structural Analysis Lecture No.1
22/27
Vectors Matrices having single row/column, also referred to as array
- Elements must be enclosed in square brackets x=[1 4 9 8]
- Elements must be separated by spaces or commas
Can be initialized using colon operator
>> x= 1:10;
Other vectors can be defined in terms of defined vector x.
>> y= 2.*x
>> z= sin(x)
>> X= 0:0.1:10;
NOTE: colon, element-wise operations , grid, plot, disp, whos
7/25/2019 Structural Analysis Lecture No.1
23/27
Vector Transpose To create column vectors
- Elements separated by semi colon
- Transpose of row vector using a single
apostrophe e.g, x=[1 7 3 8 6]
Function linspace to initialize vector having equallyspaced values
x= linspace (0,pi/2,10) creates 10 equally spacedelements from 0 to pi/2.
7/25/2019 Structural Analysis Lecture No.1
24/27
Vector Subscripts Used to refer particular elements of a vector
A subscript is indicated by paranthesis
It may be a scalar or a vector
In MATLAB it always starts with 1.
Fractional subscripts are not allowed
7/25/2019 Structural Analysis Lecture No.1
25/27
Like, r=rand(1,7)
r(3) displays third element
r(2:4) displays second third and fourth element.
To remove elements from a vector use subscripts
r([1 7 2])= []
7/25/2019 Structural Analysis Lecture No.1
26/27
Matrices Like a table consisting of rows and columns
Created just like vectors
Semicolon is used to indicate the end of the row
Can be transposed in the same fashion as vectors
Can also be created using vectors of same length
7/25/2019 Structural Analysis Lecture No.1
27/27
Cut, Paste
Script Files
Save
Run