CM0268_Exam_2009_SOLNS

# CM0268_Exam_2009_SOLNS - CM0268 SOLUTIONS CARDIFF...

This preview shows pages 1–5. Sign up to view the full content.

CM0268 SOLUTIONS CARDIFF UNIVERSITY EXAMINATION PAPER Academic Year: 2008/2009 Examination Period: Spring Examination Paper Number: CM0268 SOLUTIONS Examination Paper Title: Data, Audio, Graphics and Image Signal Processing with MATLAB SOLUTIONS Duration: 2 hours Do not turn this page over until instructed to do so by the Senior Invigilator. Structure of Examination Paper: There are 17 pages. This examination paper is divided into 2 sections. There are 4 questions in total. There are no appendices. The mark obtainable for a question or part of a question is shown in brackets alongside the question. Students to be provided with: The following items of stationery are to be provided: ONE answer book. Instructions to Students: Answer 3 questions. Answer the question 1 from Section A and two out of three questions from Section B. Questions from each Section should be answered in the same answer book. The use of calculators without programmable memory is permitted. The use of translation dictionaries between English or Welsh and a foreign language bearing an appropriate departmental stamp is permitted in this examination. 1 PLEASE TURN OVER

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
CM0268 SOLUTIONS Section A Question 1 is compulsory Q1. (a) What is the output from the following MATLAB statements: i. i=1:5 [1] Output is: >> i=1:5 i = 1 2 3 4 5 1 Mark — Unseen Problem ii. i=1:5; i. * i [1] Output is: >>i=1:5; >>i. * i ans = 1 4 9 16 25 1 Mark — Unseen Problem iii. i=1:5; i * i’ [2] Output is: >>i=1:5; >>i * i’ ans = 55 2 Marks — Unseen Problem 2
CM0268 SOLUTIONS iv. i=1:5; a = [8 9]; i(3:4) = a [2] Output is: >>i=1:5; >>a = [8 9]; >> i(3:4) = a i = 1 2 8 9 5 2 Marks — Unseen Problem 6 Marks (sub part total) (b) The following MATLAB statements contain an error, state what the cause of the error is and correct the statement: i. i = 1:10; i * i; [2] Error is: >> i = 1:10; >> i * i; ??? Error using ==> mtimes Inner matrix dimensions must agree. Solution is to either use i. * or i * i’ depending on what computation was mean to achieve. 2 Marks — Unseen Problem. One for cause and one for correction 3 PLEASE TURN OVER

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
CM0268 SOLUTIONS ii. i = 1:10; a = ones(1,5); i(2:5) = a; [4] Error is: >> i = 1:10; >> a = ones(1,5); >> i(2:5) = a; ??? In an assignment A(I) = B, the number of elements in B and I must be the same. Correction is to do either i(1:5) = a; or i(2:6) = a; depending on what the indexing was meant to be. 4 Marks — Unseen Problem. 2 for cause and 2 for correction iii. a = ones(3); b = [1 2 3]; a * b; [4] Error is: >>a = ones(3); >> b = [1 2 3]; >> a * b; ??? Error using ==> mtimes Inner matrix dimensions must agree. Mistake is that b should be a column vector. Correction is: >>a = ones(3); >> b = [1 2 3]; >> a * b’; 4 Marks — Unseen Problem. 2 for cause and 2 for correction 10 Marks (sub part total) (c) Give MATLAB code to achieve the following: i. Create an error dialog with the warning “You have made a very silly mis- take!” with the window title “Error Detected” [2] Solution is: errfig = errordlg(’You have made a very silly mistake!’,. ...
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 17

CM0268_Exam_2009_SOLNS - CM0268 SOLUTIONS CARDIFF...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online