Middle East Technical University Me 208 - Dynamics Matlab Notes Matlab Window
Middle East Technical University Me 208 - Dynamics Matlab Notes Matlab Window
Middle East Technical University Me 208 - Dynamics Matlab Notes Matlab Window
s namely Workspace, Command History and Command Window. Command Window is where you enter your command lines to do any operation. You can watch your previous commands on Command History and you can call one or a selection of them. You can access your variables defined in your workspace from the Workspace window. Definitions: Single variables can be created by directly assigning them a value: >> a = 10 Return values of a function can also be used to assign the first value: >> a = sin(pi/3) To define matrices the following format should be used: >> a = [1 2; 3 4] produces a matrix of a = 1 3 2 4
Defining a vector is similar. For a row and column vector: >> a = [1 2 3 4 5] >> b = [1;2;3;4;5] produces matrices of a = b = 1 1 2 3 4 5 If an independent variable like an angle or time is needed, an incremental series can be created by: >> theta = 0 : 0.1 : 359.9 which produces theta = 0 0.1 0.2 0.3 ... 359.9 2 3 4 5
Basic Operations: Basic operations can be listed as: Operation Addition Subtraction Multiplication Division Power Transpose Determinant Inverse Identity Matrix Syntax a+b a-b a*b a/b x^y a det(a) inv(a) eye(m,n) Matrix a.*b for term by term multiplication martix division (a/b and a\b differ) a.^b for term by term calculation
Some trigonometric and logarithmic fuction are: Fuction Sine Cosine Tangent Cotangent Arcsine Arcosine Arctangent Arccotangent Arctan2 Natural Logarithm Base 10 Logarithm Plots: Variables can be plotted by either right clicking the variable in workspace window and selecting plot 2d graph, or by using the commands: y only >> plot(y) y vs. x >> plot(x,y) Syntax sin(x) cos(x) tan(x) cot(x) asin(x) acos(x) atan(x) acot(x) atan2(x,y) log(x) log10(x)
AB
>> beta = 30:0.5:180 >> beta = beta/180*pi >> teta = (pi-beta)/2 >> w = 0.6 >> AB = 150 >> CB = 150 >> tetadot = -w/2 >> rddot = tetadot.^2*(2*AB*cos(teta)) + AB*w^2*(cos(beta).*cos(teta)-sin(beta).*sin(teta)) >> plot(teta,rddot) These lines will produce a graph like:
-5
-10
-15
-20
-25
-30
0.2
0.4
0.6
0.8
1.2
1.4
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: