Вы находитесь на странице: 1из 4

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

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

Started on Thursday, 3 October 2019, 1:00 PM


State Finished
Completed on Thursday, 3 October 2019, 2:40 PM
Time taken 1 hour 39 mins
Marks 11.75/16.00
Grade 73.44 out of 100.00

Question 1 Define a vector V with many elements (10,000 or 100,000 or more) and compute its histogram with 120 bins (or buckets)
Incorrect and assign this histogram to a variable h. This variable h contains a lot of information. To get the vector which is plotted
Mark 0.00 out of by the command histogram we execute
1.00

Select one:
a. h.Values

b. h.Data

c. get(h,nbins)

d. h.nbins 

e. get(h,Values)

Your answer is incorrect.

The correct answer is: h.Values

Question 2
Create a vector V with 100,000 elements of random numbers uniformly distributed between 0 and 1. Calculate its
Correct
histogram with 1000 bins. Then calculate the histogram of the histogram with 20 bins. What does the histogram of the
Mark 1.00 out of
histogram look like? Do it several times and experiment with bigger random vectors and histograms. Notice that function
1.00
histogram returns a weird data structure that contains a lot of information. Among this information is the vector of the bin
(or bucket) populations. To get the actual histogram vector you need to answer the first question of this quiz correctly.
What does the histogram of the histogram of vector V look like?

Select one:
a. Looks roughly like a Gaussian (what outsiders call "Bell Curve") 

b. Looks like a uniform distribution

c. This is a histogram square and is conceptually similar to the burger square from that Simpsons episode so Matlab
may catch mad cow disease.

d. The histogram of the histogram of V looks like the histogram of V

e. It is just a jagged line resembling nothing.

Your answer is correct.

The correct answer is: Looks roughly like a Gaussian (what outsiders call "Bell Curve")

https://moodle.yorku.ca/moodle/mod/quiz/review.php?attempt=2437124&cmid=2186423 1/4
12/24/2019 Lab 4 (Thu): Attempt review

Question 3 What is a good name for a script. To find out try to save a script under different names (using save-as in the save menu)
Correct and then try to execute it by typing its name.
Mark 1.00 out of
1.00 Select one:
a. Any filename that would make a good variable name followed by a .m in the end 

b. Any name the operating system will accept (Windows, Apple OS, Linux)

c. Any filename with a .mat in the end

d. Any file name with a .m in the end

e. Any filename that would make a good variable name followed by a .mat in the end

Your answer is correct.

The correct answer is: Any filename that would make a good variable name followed by a .m in the end

Question 4 What is a proper filename to be used in conjunction with fprintf in order to write something in a file. To find out, write a
Incorrect short script that prints something in a file and/or search the documentation.
Mark 0.00 out of
1.00 Select one:
a. Any name that ends with .m

b. Any name that could be a variable name with a .mat in the end

c. Any name that the operating system (Windows, Mac OS, Linux) accepts

d. Any name that ends with .mat

e. Any name that could be a variable name followed by a .m in the end 

Your answer is incorrect.

The correct answer is: Any name that the operating system (Windows, Mac OS, Linux) accepts

Question 5 We live in a three dimensional world and vectors tend to be 3-D, but we can define vectors with 10, 100, or 1000
Incorrect dimensions. Mathematicians and engineers find high dimensionality vectors very useful. And the same way we compute
Mark 0.00 out of the angle between two vectors in 3-D using dot-products, we can compute the angle between two vectors in 1000-D also
1.00 using the dot product. The dot product of two vectors is equal to the product of the magnitudes of the vectors times the
cosine of their included angle. Knowing this we can compute the dot product of two vectors by using function dot, then
compute their magnitudes using function norm and from this find the cosine of their angle and then their angle. For this
question you have to define two random vectors with at least 1000 (yes, a thousand) dimensions using randn and then
compute the angle using dot product. What is the angle between the two such random vectors. To investigate this write a
short script and run it several times.

Select one:
a. The angle is anything between 0 and 180 degrees, more or less uniformly 

b. The angle between two vectors with more than 3 dimensions is not defined hence

c. The angle is very close to 90 degrees, or very close to -90 degrees

d. The angle is anything between 0 and 360 degrees, more or less uniformly

e. The angle is anything between -90 and 90 degrees, more or less uniformly distributed

Your answer is incorrect.

The correct answer is: The angle is very close to 90 degrees, or very close to -90 degrees

https://moodle.yorku.ca/moodle/mod/quiz/review.php?attempt=2437124&cmid=2186423 2/4
12/24/2019 Lab 4 (Thu): Attempt review

Question 6
The formula
Correct
S = (R-1)(R+1)-1
Mark 1.00 out of
1.00 is known as the Cayley Identity. Given an orthogonal matrix R it gives us a matrix S which is skew symmetric. Its sister
identity
R= (1-S)-1(1+S)

does the opposite and we will use it to create an orthogonal matrix R.


It is easy to create a skew symmetric matrix S first by creating a random matrix M, then assign S = M - M'. Now S is skew
symmetric. After you create the skew symmetric matrix S, create matrix R using the second of the Cayley's identities and
the compute the determinant of R. What is the determinant of R.

Select one:
a. The determinant of R is all over the real numbers.

b. The determinant of R is always -1 (or very very close to it)

c. The determinant of R is always 1 (or very very close to it) 

d. The determinant of R is between -1 and 1

e. The determinant of R is always 0 (or very very close to it)

Your answer is correct.


The correct answer is: The determinant of R is always 1 (or very very close to it)

Question 7 Define a vector with a 100 (or more) elements. Each element is a random number between 0 and 1, uniformly distributed.
Incorrect What is the mean and standard deviation. Since a matlab script will create a different set of random numbers and hence
Mark 0.00 out of different mean and standard deviation, run the script several times and maybe use (many) more than 100 elements (the
1.00 bigger the vector the more useful the mean and standard deviation you compute). You can use the functions mean and
std.

Select one:
a. Mean is about 0 and standard deviation is about 1.2

b. Mean is about 0.5 and standard deviation is about 3.2

c. Mean is about 0.5 and standard deviation is about 0.29

d. Mean is about 0 and standard deviation is about 1.0 

e. Mean is about 10 and standard deviation is about .45

Your answer is incorrect.


The correct answer is: Mean is about 0.5 and standard deviation is about 0.29

Question 8 What is hold on


Correct

Mark 1.00 out of Select one:


1.00
a. A Matlab trick to put many curves on a single plotting window. You pair it with hold off. 

b. What you are told if you call Mathworks (the company that makes Matlab) for support

c. A Matlab command to temporarily stop long computations

d. A Matlab command to avoid printing big matrices that may fill the whole screen

e. A Matlab statement to tell Matlab to double check the results

Your answer is correct.


The correct answer is: A Matlab trick to put many curves on a single plotting window. You pair it with hold off.

https://moodle.yorku.ca/moodle/mod/quiz/review.php?attempt=2437124&cmid=2186423 3/4
12/24/2019 Lab 4 (Thu): Attempt review

Question 9 In this question you will plot three parametric curves on the same window. You define three variables that will control
Complete aspects of your program. The first is nump which is the number of points in the plot. The two others Nx and Ny will control
Mark 7.75 out of the "frequency" of the plots (the number of periods in 0..2*pi). Assign 100 to nump when you submit your script but make
8.00 sure to try several different values of nump to verify the correctness of the script.

Vector T will represent the parameter of the parametric plot. Define it to have nump elements. The first should be 0 and the
last 2*pi. To plot the first curve you define two vectors X and Y whose values are the cosine and sine of the corresponding
elements of T respectively. The plot will look like a circle (or en ellipse, depending on how Matlab decides to scale the
axes). Now, to have more interest, we make the X or the Y vary faster by multiplying T with Nx and Ny. If we set them to 1.0
and 2.0 respectively then we get a curve that looks like the symbol of infinity. This is the first curve. Make your script plot
three curves in the same plot using hold on and hold off. The second should have Nx and Ny 2.0 and 3.0 and the third 1.0
and 4.0 respectively. The three curves should have colors red, green, and blue. The script file should be named
plotscopeXXXX.m, where XXXX is your user ID, and should start with a comment containing your name.

plotscopejair2018.m

Comment: there is no need to put a hold off after each plot

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

https://moodle.yorku.ca/moodle/mod/quiz/review.php?attempt=2437124&cmid=2186423 4/4

Вам также может понравиться