2 views

Uploaded by Seshan R.V

Matlab

- Matlab Introduction
- Programming Assignments
- Experiment 1.pdf
- Curso de Introduccion Al Matlab2
- matlab1
- MATLAB
- CDROM Appendix E
- 1-Intro to Matlab
- Matlab Fem
- Basic Matlab Material
- matlab_tutorial.pdf
- Problem Solving in Chemical Engineering With Matlab[1]
- Introduction to MatLab
- An introduction to Octave
- Introduction to Matlab
- Am 2032 Sample
- Computer Programming I: MATLAB - CS 021 ZR1 - Course Syllabus or Other Course-Related Document
- Lax Representations for Matrix Short Pulse Equations
- Matlab challenge at high school level
- application finite element method in structural analysis 1

You are on page 1of 5

Homologation

Extra exercises (2015)

By: Bouke Haarsma

This document contains extra exercises for the Matlab-basics homologation module. These exercises

will be harder compared to the module offered on oncourse. (http://oncourse.tue.nl).

Please use these questions as confirmation you understand the material, so solve these exercises

individually! It is also recommended to use the mathworks documentation

(http://mathworks.com/help) and matlab help command, before asking for help or copying code

from Google. By doing so, you will be better prepared when help is not easily available.

Good luck!

Bouke

Exercises

1. Starting

a)

25

25 1

5 1

1

b. 3

( 5 + 1) 2

a.

b)

a. e 3 , ln(e 3 ),10 log(e 3 ),10 log(10 5 )

b. e 163

c. Solve 3 x = 17

c)

a.

d)

e)

f)

b. 3

Give an array of 10 elements in which each element has the value of the square of the

index.

Give an array of 10 elements in which the elements of odd index contain the square of

the index, while the even elements contain the third power of their index.

Theres a popular story that Gauss, mathematician extraordinaire, had a lazy teacher. The so-called

educator wanted to keep the kids busy so he could take a nap; he asked the class to add the

numbers 1 to 100.

a) Create a vector X which has the values from 1 to 100.

b) Take the sum of all elements to get the solution

Since Gauss did not have Matlab at the time, he used a different solution. He added the first and last

number in the series and multiplied it with the numbers of pairs in the series.

c) Add the first and the last index together in the variable P. Use X(end) to get the last number

in the vector.

d) Since the vector has an even number of numbers, use the length of the vector to determine

the number of pairs in the series.

e) Calculate the solution using the method from Gaus.

f) The solution given in c) d) and e) should work for all vectors. Create a script with the

commands from these questions, and test it with a vector from 1 to 300.

3. Going diagonal

Create the following matrices using one line in the command window without defining the matrix

element wise. (Use the Matlab help!):

0 0 0

a) = 0 0 0

0 0 0

1 1 1

b) = 1 1 1

1 1 1

1 0 0

c) = 0 1 0

0 0 1

1 0 0

d) = 0 2 0

0 0 3

2 0 0

e) = 2 2 0

2 2 2

f)

0 4 4

= 2 1 4

2 2 2

This exercise will create a function that will be used to plot circles. First a script will be created,

commands in the script will be later used to create a function.

a) Create a script called Ex1. Since a full circle will be drawn, this means angle is between 0

and 2 radians. So in the script, create a vector called theta containing all numbers between

0 and 2 with a step size of 1 .

b) Run the script. Verify if a) has 6 elements. Why should it have 6 elements? Why does the

vector end at 6 and not at 2?

c) The circle will have a certain radius. Call this radius R. Edit the script. Using a) and R how can

x and y vectors for this circle be obtained? For now, use R=5.

Hint: what are the equations for x and y?

d) Edit the script so the circle is plotted, is the result as expected? What can be done to

improve the results?

e) Create a new function called circ. The input for this function is R and the outputs of the

function the X and Y (these variables will be vectors). Use a) and c) for the proper equations.

f)

In the command window, use the circ function. (e.g. circ(5) ). By using only the command

window and the circ function, create X and Y values in the workspace and plot the results.

Hint: this will take 2 commands.

g) Edit the script created previously so it uses the function circ instead of manually creating the

X and Y vectors.

h) Using the Mathworks help page: what is the command for retaining multiple plots in a single

window? Also see the examples given on the page to get an idea on how to use the

command.

i)

Using the answer from g) and the circ function created. Change the script created that plots

2 circles with different radius in a single window.

5. Got it!

Matlab is very fast in many equations at once due to the usage of matrices and vectors. In this

exercise this set of equations will be solved using Matlab:

2 + 10 + 11 = 327

6 + + 11 = 286

14 + 13 + 6 = 229

12 + 14 + 10 = 332

14 + 10 + 3 = 139

&' = (

With & as matrix and ( and ' as vectors. Whereas the vector ' is equal to )*.

a) Insert the matrix & and vector ( in Matlab. What should the sizes of these variables be?

One way to solve this is retrieving the row reduced echelon form of the matrix .

b) What is the command for retrieving this form in Matlab? Use the mathworks help.

c) Use the command on the matrix [& (]. What are the answers for , and ?

d) Verify these results by constructing the vector ' and calculating the vector (. Should the *

or the .* command be used? Why?

A other way to solve this set of equations is by using the mldivide command

e) The mldivide has a shorter notation. What is this notation?

f) Solve the equations using the mldivide command.

Matlab has a lot of commands to solve this set of equations.

g) Search the help for mldivide for another command to solve this system.

- Matlab IntroductionUploaded byEr. Piush Jindal
- Programming AssignmentsUploaded byjcvoscrib
- Experiment 1.pdfUploaded bytrivedi_urvi9087
- Curso de Introduccion Al Matlab2Uploaded byunifim1102
- matlab1Uploaded bySalvador Vilca Mamani
- MATLABUploaded byShailin Sequeira
- CDROM Appendix EUploaded byLohashenpahan Shanmuganantha
- 1-Intro to MatlabUploaded byMohammad Sadiq
- Matlab FemUploaded bysohailrao
- Basic Matlab MaterialUploaded byGogula Madhavi Reddy
- matlab_tutorial.pdfUploaded byBerkay Özerbay
- Problem Solving in Chemical Engineering With Matlab[1]Uploaded byweijee
- Introduction to MatLabUploaded bysamasimo5
- An introduction to OctaveUploaded byهانى خير
- Introduction to MatlabUploaded byKarthik Sivanesarajah
- Am 2032 SampleUploaded bymichaelfoley98
- Computer Programming I: MATLAB - CS 021 ZR1 - Course Syllabus or Other Course-Related DocumentUploaded byContinuing Education at the University of Vermont
- Lax Representations for Matrix Short Pulse EquationsUploaded byraveneyesdead
- Matlab challenge at high school levelUploaded byPaul Werbos
- application finite element method in structural analysis 1Uploaded byGopal Vamssi
- Learn backtesting using MATLAB - Quantitative Finance Stack Exchange.pdfUploaded byenghoss77
- MATLAB PrimerUploaded byAbhinav Anand
- Mat BasicsUploaded byShashi Gururani
- Lecture 2Uploaded byJavier Pedrosa
- MATLAB - Wikipedia, The Free EncyclopediaUploaded byviketjha
- Exercises 16.06 16.07 Matlab SimulinkUploaded byflowerboy
- Matrix 1Uploaded bychandrasmg
- Computer Programming I - CS 021 OL1 - Course Syllabus or Other Course-Related DocumentUploaded byContinuing Education at the University of Vermont
- MATLAB Fundamentals-An Overview UGC ASC Burdwan Univ Sept2013Uploaded byNiladri Dey
- Learn backtesting using MATLAB - Quantitative Finance Stack Exchange.pdfUploaded byenghoss77

- OOPS Basic UnderstandingUploaded byalok_patro565
- Symmetrix FoundationsUploaded byVenkatesh Chittimeni
- baka.pdfUploaded byAnonymous 9uu04el
- Working With Google DriveUploaded bySharukhBurondkar
- Marketing ResearchUploaded bysurendrakch
- SW Equations Ex1aUploaded byemigrantu
- Burton, Encouraging Algorithmic Thinking Without a ComputerUploaded bySezen Molagean
- PIC 600 InstruccionesUploaded bypaedalexpa
- Nvidia Placement PaperUploaded bySaurabh Verma
- Lecture02_ComputerApplicationsIE1_DrAtifShahzad.pdfUploaded byatifshahzad
- UntitledUploaded byJerry Oderinde
- TRUSTe Data Privacy Management Solutions Overview BrochureUploaded byTrustArc
- Eclipse Effective Usefull Shortcut KeysUploaded bySumit Kumar
- Data Structures Cheat SheetUploaded byOmer Shapira
- Tanner Tools S-Edit TutorialUploaded bymdzakir_hussain
- Week 2- lesson 5Uploaded byJeffrey C. Flores
- Mod_3_LN[1]Uploaded byMajeed Patel
- DB2 Cheat SheetUploaded bymuthucharam
- Asigra Ranked Number One Cloud Backup Enabler in 2019 Report by BackupReviewUploaded byPR.com
- Correspondence and Isomorphism Theorems for Intuitionistic fuzzy subgroupsUploaded byjournal
- Quant Methods MCQUploaded byTamil Selvan
- cl 8 eeUploaded byapi-250124002
- AnswersUploaded byPawan Lad
- LT Teacher Computer Science BookUploaded byraghaveshidea
- Chapter 05 - Msp430 IsaUploaded byokocha712
- 5 Principles for Securing DevOpsUploaded byeltuerca71
- chtp7_AppFUploaded byh_hab
- EC2312-LP-AUploaded byJefferson Thompson
- Chater 7Uploaded bySabir Ali
- BOMGAR Whitepaper Support SwarmingUploaded byTobey Watson