Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Practice Problems on Engineering Computations - Experiment 7 | MET 4903, Lab Reports of Mechanical Engineering

Material Type: Lab; Professor: Nasseri; Class: SpTp-Engineering Computations; Subject: Mechanical Engineering Tech; University: Southern Polytechnic State University; Term: Unknown 1989;

Typology: Lab Reports

Pre 2010

Uploaded on 08/03/2009

koofers-user-e4a
koofers-user-e4a 🇺🇸

4.5

(2)

10 documents

1 / 4

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Lab 7 Practice Problems Engineering Computation, Dr S. Nasseri
Try these:
>> C= [ 3 2 0 3 4 4 2 1]
>> length(C) = 8
>> diff(A)
>> [-1 -2 3 1 0 -2 -1]
>> length(diff(C))
>> 7
Consider the following matrix A. Try the diff command for this matrix:
1 6
7 12
A= 3 0
14 9
6 1
, >>diff (A) = ?
6 6
-4 -12
11 9
-8 -8
Without typing “help diff”, try theses ones for the same matrix A and guess what each does (these
commands have applications in signal processing):
Af1= diff(A, 1)
6 6
-4 -12
11 9
-8 -8
First order difference along the first
dimension (Matlab does all the operations on
column by default, or you can say the operation
of row differences)
Af2 = diff(A, 2)
-10 -18
15 21
-19 -17
Second order difference along the first
dimension (Considers the diff(A,1)). This is
again the operation of row differences.
Af11 = diff(A,1,1)
6 6
-4 -12
11 9
-8 -8
First order difference along the first
dimension (the operation of row differences).
Af22= diff (A,1,2)
6 - 1 = 5
12-7 = 5
0 - 3 = -3
9-14 = -5
1- 6 = -5
First order difference along the second
dimension (the operation of column differences.)
Af12 = diff(A,2,1)
-10 -18
15 21
-19 -17
Second order difference along the first
dimension (the operation of row differences)
Af22 = diff (A,2,2)
Empty matrix: 5-by-0
Second order difference along the second
dimension (the operation of column
differences.). Since we have only one column, it
returns an empty matrix.
pf3
pf4

Partial preview of the text

Download Practice Problems on Engineering Computations - Experiment 7 | MET 4903 and more Lab Reports Mechanical Engineering in PDF only on Docsity!

Lab 7 Practice Problems Engineering Computation, Dr S. Nasseri

Try these:

>> C= [ 3 2 0 3 4 4 2 1]

length(C) = 8

diff(A)

>> [-1 -2 3 1 0 -2 -1]

length(diff(C))

Consider the following matrix A. Try the diff command for this matrix:

A= 3

, >>diff (A) =?

Without typing “help diff”, try theses ones for the same matrix A and guess what each does (these

commands have applications in signal processing):

Af1= diff(A, 1)

First order difference along the first

dimension (Matlab does all the operations on

column by default, or you can say the operation

of row differences)

Af2 = diff(A, 2)

Second order difference along the first

dimension (Considers the diff(A,1)). This is

again the operation of row differences.

Af11 = diff(A,1,1)

First order difference along the first

dimension (the operation of row differences).

Af22= diff (A,1,2)

First order difference along the second

dimension (the operation of column differences.)

Af12 = diff(A,2,1)

Second order difference along the first

dimension (the operation of row differences)

Af22 = diff (A,2,2)

Empty matrix: 5-by-

Second order difference along the second

dimension (the operation of column

differences.). Since we have only one column, it

returns an empty matrix.

Try to use syms ‘x’ and differentiate the following functions:

Example:

For function  

2 cos x (^) :

syms 'x' % or x = sym('x')

y= cos(x)^2; % you don’t place. before ^

diff(y,x) % derivative of y with respect to x

ans =

-2cos(x)sin(x)

2 -x

2

e y=

x  3 xx

syms 'x'

y= exp(-x^2)/(x^2 - 3*x + sqrt(x))

y =

exp(-x^2)/(x^2-3*x+x^(1/2))

diff(y,x)

ans =

-2xexp(-x^2)/(x^2-3x+x^(1/2))-exp(-x^2)/(x^2-3x+x^(1/2))^2(2x-3+1/2/x^(1/2))

Which is:

2 2

(^2 )

2

2 e e

x x

x

x x x

x x x x

x

 

2 2

y=

cos x sin x

syms 'x'

y=1/(cos(x^2)+sin(x^2))

y =

1/(cos(x^2)+sin(x^2))

diff(y,x)

ans =

-1/(cos(x^2)+sin(x^2))^2(-2sin(x^2)x+2cos(x^2)*x)

2 2

y=

cos xx .sin x

syms 'x'

y = 1/(cos(x^2)+sqrt(x)*sin(x^2))

y =

1/(cos(x^2)+sin(x^2)*x)

diff(y,x)

ans =

-1/(cos(x^2)+x^(1/2)sin(x^2))^2(-2sin(x^2)x+1/2/x^(1/2)sin(x^2)+2x^(3/2)*cos(x^2))

1 1.5 2 2.5 3 3.

-0.

-0.

-0.

-0.

0

1

Backward

Forward

Central