Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

DATA PROCESSING

Marcel Kaminski

MATLAB Introduction:
Basics - Exercise Sheet

FAKULTÄT TECHNIK UND INFORMATIK


Department Fahrzeugbau

Faculty of Engineering and Computer Science


Department Automotive Engineering

HOCHSCHULE FÜR ANGEWANDTE


WISSENSCHAFTEN HAMBURG
Hamburg University of Applied Sciences
Exercises: Introduction / Basics

Exercise 0

Open up the script editor → "New Script", you are now inside the editor environment.
You can save as many commands as you want as an m-file inside this environment.
Provide the m-file with an appropriate file header, a file header should look like the one
you see in figure 0.1.

Figure 0.1. First hit the "New Script" Button then insert/type a header

Then save this m-file in any directory, and afterward solve the following exercises inside
this file. Each solution shall be displayed via the "disp" command.

Exercise 1

The following vectors are given


     
1 −1 1
  ⃗  
⃗a = −4 , b =  4  and ⃗c = −2 .
 

2 2 −4

From this, determine the following expressions:

d⃗ = ⃗a + ⃗b − ⃗c,
⃗e = 2⃗a + 4(⃗b − 3⃗c),

This document is used exclusively for teaching at HAW Hamburg and must not be
2
used for other purposes or passed on to third parties. M. Kaminski, 2022
d⃗ = ⃗a + ⃗b − ⃗c.

Exercise 2

Determine the magnitudes/values ( |⃗x| ) of the following vectors:


     
5 4 −1
  ⃗  
⃗a = 4 , b =  0  and ⃗c = −9 .
 

3 −3 3

Also determine a unit vector in direction ⃗a - ⃗c.

Exercise 3

The following vectors are given


       
1 2 −2 3
  ⃗   ⃗
⃗a = 2 , b = 3 , ⃗c = −4 and d = 6 .
   

3 4 −6 9

Determine the following expressions:


e = ⃗a ∗ (⃗b ∗ ⃗c) ∗ d,

f⃗ = ⃗a × ⃗b + ⃗c × d,

⃗g = (⃗a ∗ ⃗b) × ⃗c + ⃗a × ⃗c,
⃗h = ((⃗a ∗ (⃗b × ⃗c)) ∗ d)
⃗ + ⃗b × ⃗c.

Exercise 4

Define the following matrices and assign them with the appropriate variables:
 
  1 0 0 0
3 + 4i 4 + 3j 9  
0 1 0 0 T
A =  −i 10j 8  , Eye = 0 0 1 0 , C = A
   
3 1.001 911
 
0 0 0 1

This document is used exclusively for teaching at HAW Hamburg and must not be
3
used for other purposes or passed on to third parties. M. Kaminski, 2022
Exercise 5 (optional)

The following vectors are given


   
1 2
  ⃗
⃗a = −1 and b =  1  .
 

−1 −2

Determine the following values


1. the angle enclosed by the two vectors,
2. the area of the parallelogram spanned by the vectors,
3. the two diagonals of the parallelogram,
4. a normal unit vector on the surface formed by the two vectors,
5. the projection of a onto b.

This document is used exclusively for teaching at HAW Hamburg and must not be
4
used for other purposes or passed on to third parties. M. Kaminski, 2022

You might also like