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

12/24/2019 Lab 8 (Thu): Attempt review

Dashboard / My courses / LE/EECS1560 A - Introduction to Computing for Mathematics and Statistics (Fall 2019-2020) / Lab 8 Material
/ Lab 8 (Thu)

Started on Thursday, 14 November 2019, 1:00 PM


State Finished
Completed on Thursday, 14 November 2019, 1:57 PM
Time taken 57 mins 1 sec
Marks 13.00/16.00
Grade 81.25 out of 100.00

Question 1 Create two random vectors V1 and V2 whose elements sum up to 1. To create a vector whose elements sum up to one, you
Incorrect first create a random vector and then divide it by the sum of its elements. Then create V = conv(V1,V2). The sum of all the
Mark 0.00 out of elements of V is
1.00

Select one:
a. It is always 1

b. It is always zero

c. It is either positive 1 or negative 1.

d. It is an integer value and depends on the first elements of the arrays V1 and V2 

e. It is an integer value that depends on the size of the vectors

Your answer is incorrect.

The correct answer is: It is always 1

Question 2 To compute the polynomial that results from raising 1+x to the nth power we
Correct

Mark 1.00 out of Select one:


1.00
a. use S=1; for i=1:n S=conv(S,[1, 1]); end 

b. use (1+x)^n

c. use S=1; for i=1:n S=conv(S,S); end

d. use conv([1, 1],n)

e. use [1, 1]^n

Your answer is correct.

The correct answer is: use S=1; for i=1:n S=conv(S,[1, 1]); end

Question 3 Function polyval in Matlab


Incorrect

Mark 0.00 out of Select one:


1.00
a. Returns the roots of a polynomial if they are real numbers.

b. Returns the values of a polynomial for one or more values of x (the independent variable).

c. Plots the polynomial 

d. Returns true if the polynomial has a rational value.

e. Returns true if the polynomial is multi-valued

Your answer is incorrect.

The correct answer is: Returns the values of a polynomial for one or more values of x (the independent variable).

https://moodle.yorku.ca/moodle/mod/quiz/review.php?attempt=2522411&cmid=2217625 1/3
12/24/2019 Lab 8 (Thu): Attempt review

Question 4 Function poly in Matlab


Correct

Mark 1.00 out of Select one:


1.00
a. Returns true if its argument is a polynomial

b. Accepts a vector of roots and returns a polynomial that has these roots. 

c. Produces a polymer out of its argument

d. Accepts a vector of coefficients and returns a polynomial

e. Accepts a set of x and y pairs and returns a polynomial that goes through these x and y pairs.

Your answer is correct.

The correct answer is: Accepts a vector of roots and returns a polynomial that has these roots.

Question 5 Let p1 be a random vector and p2 = poly(roots(p1)). Then the angle between p1 and p2 is
Correct
(Note: the angle of two vectors was discussed in a previous lab)
Mark 1.00 out of
1.00
Select one:
a. 90 degrees

b. 1 radian

c. indeterminable (cannot be determined).

d. 1 degree

e. 0 degrees. 

Your answer is correct.


The correct answer is: 0 degrees.

Question 6 Let V be a vector of 100 random elements uniformly distributed between 0 and 1. If we convolve V with vector h=
Correct [0.25,0.5,0.25] several times (like V=conv(V,h)) we get
Mark 1.00 out of
1.00 Select one:
a. A vector that has fewer elements with each successive convolution

b. A vector that looks more jagged (rougher) with each successive convolution

c. A random vector that is also uniformly distributed between zero and one (in other words its histogram is more or
less flat)

d. A vector whose plot looks smoother with each successive convolution 

e. A vector whose histogram looks more like a triangle with each successive convolution

Your answer is correct.


The correct answer is: A vector whose plot looks smoother with each successive convolution

https://moodle.yorku.ca/moodle/mod/quiz/review.php?attempt=2522411&cmid=2217625 2/3
12/24/2019 Lab 8 (Thu): Attempt review

Question 7
The code
Correct
fplot(@(x)polyval(pp,x),[-3,3])
Mark 1.00 out of
plots a function using the built-in function fplot. The first argument to fplot is
1.00

Select one:
a. The handle of an anonymous function 

b. A function named pp

c. A vector

d. A function named polyval

e. A polynomial in the standard Matlab anonymous representation of polynomials

Your answer is correct.

The correct answer is: The handle of an anonymous function

Question 8 If the following function is defined


Incorrect function [ res ] = funfun( Fun )
Mark 0.00 out of %FUNFUN is a function function
1.00 % Calls function Fun with argument 3
% It is only meant as a simple example
% Minas Spetsakis (March 2016)

res = Fun(3);

end

then it can be meaningfully invoked with argument

Select one:
a. 'sin' as in funfun('sin')

b. Can be invoked with any argument since it is meant for geekgeeks to have funfun 

c. sin as in funfun(sin)

d. @sin as in funfun(@sin)

e. Cannot be invoked since it has a bug

Your answer is incorrect.


The correct answer is: @sin as in funfun(@sin)

Question 9 Write a function named gaussvector that accepts one argument n and returns a vector G of the coefficients of the
Complete polynomial a*(1+x)^n with a chosen so that the the sum of all the elements of G is 1.
Mark 8.00 out of As always your code should be properly indented, have a brief description of what it does and include your name and
8.00
date.

gaussvector.m

Comment:

◄ Lab 8 (Tue) Jump to... Lecture Notes and Examples ►

https://moodle.yorku.ca/moodle/mod/quiz/review.php?attempt=2522411&cmid=2217625 3/3

You might also like