MATH数学代写-Linear Algebra代写-MATLAB代写
MATH数学代写

MATH数学代写-Linear Algebra代写-MATLAB代写

Homework 1

MATH数学代写 We will characterize them as a rotation along the 𝑋 − 𝑌 plane, a rotation along the 𝑌 − 𝑍 plane and rotation along the 𝑍 − 𝑊 plane.

Problem 1: Linear Algebra  MATH数学代写

Let’s warm up with a simple algebra problem.

1a. Rotational Matrices

I) A rotation in 4-D (Whose coordinates we will call 𝑋,𝑌, 𝑍 and 𝑊) is characterized by three angles. We will characterize them as a rotation along the 𝑋 − 𝑌 plane, a rotation along the 𝑌 − 𝑍 plane and rotation along the 𝑍 − 𝑊 plane. Derive the rotation matrix 𝑅 that transforms a vector [𝑥, 𝑦, 𝑧, 𝑤] 𝑇 to new vector [𝑥̂, 𝑦̂, 𝑧̂, 𝑤̂] 𝑇 by rotating it counter-clockwise by an angle 𝜃 along the 𝑋 − 𝑌 plane, an angle 𝛿 along the 𝑌 − 𝑍 plane and an angle 𝜙 along the 𝑍 − 𝑊 plane.

II) Confirm that 𝑅𝑅 𝑇 = 𝐼.

1b. Lengths of Vectors

I) The following matrix transforms 5-dimensional vectors into 4-dimensional ones

MATH数学代写
MATH数学代写
  1. A 5 × 1 vector 𝑣 of length 1 is transformed by 𝐴 as 𝑢= 𝐴𝑣. What is the longest length that 𝑢 can be?
  1. What is the shortest non -zero length of 𝑢?
  1. What is the rank of 𝐴? The null space of 𝐴 is the space of all vectors 𝑣 such that 𝐴𝑣= 0.
  1. What is the dimensionality of the null space of 𝐴?

II) Answer the above four questions for the following matrix. Here 𝐵 transform 4-D vectors to 5-D. Note that 𝐵= 𝐴 𝑇.

III) The “Restricted Isometry Property” (RIP) constant of a matrix characterizes the change in length of vectors transformed by sub-matrices of the matrix. For our matrix 𝐴, let 𝐴𝑠 be a matrix formed of any 𝑠 columns of 𝐴. If 𝐴 is 𝑀 × 𝑁, 𝐴𝑠 will be 𝑀× 𝑠. We can form 𝐴𝑠 in 𝐶𝑠 𝑁 ways from the 𝑁 columns of 𝐴(we assume that the order of vectors in 𝐴𝑠 is immaterial). Let 𝑤 be an 𝑠× 1 vector of length 1. Let 𝑙𝑚𝑎𝑥 be the longest vector that one can obtain by transforming 𝑤 by any 𝐴𝑠. Let 𝑙𝑚𝑖𝑛 be the shortest vector obtained by transforming 𝑤 by any 𝐴𝑠. The RIP-s constant 𝛿𝑠 of the matrix 𝐴 is defined as:

1.What is 𝛿2(i.e., 𝛿𝑠 for 𝑠 =2)for the matrix 𝐴 given above? Hint you must consider all 5𝐶2 possib ilities for 𝐴𝑠.

2.What is 𝛿3?

MATH数学代写
MATH数学代写

Problem 2: Projections  MATH数学代写

Please note all the files needed for this exercise can be found in the homework template.The recording segment Polyushka.wav, played on harmonica, has been downloaded from YouTube with permission from the Artist.

Note.tar is a tar file, which contains a set of notes from a harmonica. You are required to transcribe the music. For transcription you must determine how each of the notes is played to compose the music.

“matlab_instructions” file inside the homework package contains information how to convert each note into a spectral vector, and the entire music to a spectrogram matrix.

2a. Analysis By Individual Note:

I) For each note individually, compute the contribution of that note to the entire music.Mathematically, if 𝑁𝑖 is the vector representing the 𝑖 𝑡ℎ note, and 𝑀 the music matrix, find the row vector 𝑊𝑖 such that 𝑁𝑖𝑊𝑖 ≈ 𝑀. Return the transcription of each note.

II) Recompose the music by “playing” each note according to the transcription you just found.Mathematically, compute 𝑀̂ = ∑𝑖 𝑁𝑖𝑊𝑖 and invert the result to produce music. To invert it to a music signal, follow the instructions given in the MATLAB notes. Return the recomposed music. Comment about how the recomposed music compares to the original signal.  MATH数学代写

2b. Joint Analysis Using All Notes:

I) Compute the contrib ution of all notes to the entire music jointly. Mathematically, if 𝑁 =[𝑁1, 𝑁2 , … ] is the notes matrix where the individual columns are the notes, find the matrix 𝑊 such that 𝑁𝑊 ≈ 𝑀. The 𝑖 𝑡ℎ row of 𝑊 is the transcription of the 𝑖 𝑡ℎ note.II) Recompose the music by “playing” each note according to the transcription you just foundin problem 2b-I. Mathematically, compute 𝑀̂ = 𝑁𝑊, and invert the result to produce themusic. Return the recomposed music. Comment about how the recomposed music compares to the original signal. Is the recomposed music identical to the music you constructed in problem 2a-II? Explain your finding.

Problem 3: Optimization and Non-Negative Decomposition  MATH数学代写

Simple projection of music magnitude spectrograms (which are non-negative) onto a set of notes will result in negative weights for some notes. To explain, let 𝑀 be the (magnitude) spectrogram of the music. It is a matrix of size 𝐷 × 𝑇, where 𝐷 is the size of the Fourier transform and 𝑇 is the number of spectral vectors in the signal. Let 𝑁 be a matrix of notes. Each column of 𝑁 is the magnitude spectral vector for one note.𝑁 has size 𝐷×𝐾, where 𝐾 is the number of notes.

Conventional projection of 𝑀 onto the notes 𝑁 computes the approximation

Such that is minimized.Here is known as the Frobenius norm of 𝑀−𝑀̂. 𝑀𝑖,𝑗 is the(𝑖,𝑗) 𝑡ℎ entry of 𝑀,and𝑀̂𝑖,𝑗 is similarly the (𝑖,𝑗) 𝑡ℎ entry of 𝑀 ̂.

MATH数学代写
MATH数学代写

Please note the definition of the Frobenius norm; we will use it later.𝑀̂ is the projection of 𝑀onto 𝑁.𝑊, of course,is given by 𝑊=𝑝𝑖𝑛𝑣(𝑁)𝑀. 𝑊 can be viewed as the transcription of 𝑀 in terms of the notes in 𝑁. So, the𝑗𝑡ℎ column of M, which we represent as 𝑀𝑗 and is the spectrum in the 𝑗𝑡ℎ frame of the music, is approximated by the notes in 𝑁 as

where 𝑁𝑖 is the 𝑖 𝑡ℎ column of 𝑁 and represents the 𝑖 𝑡ℎ note, and 𝑊𝑖,𝑗 is the weight assigned to the 𝑖 𝑡ℎ note in composing the 𝑗 𝑡ℎ frame of the music.

The problem is that in this computation, we will frequently find 𝑊𝑖,𝑗 values to be negative.In other words, this model requires you to subtract some notes- since 𝑊𝑖,𝑗 𝑁𝑖 will have negative entries if 𝑊𝑖,𝑗 is negative, this is equivalent to subtracting the weighted note|𝑊𝑖,𝑗 |𝑁𝑖 in the 𝑗𝑡ℎ frame.Clearly, this is an unreasonable operation intuitively; when we actually play music, we never unplay a note (which is what playing a negative note would be).

Also,𝑀̂ may have negative entries. In other words, our projection of 𝑀 onto the notes in 𝑁 can result in negative spectral magnitudes in some frequencies at certain times. Again, this is meaningless physically- spectral magnitudes cannot, by definition, be negative.

In this homework problem we will try to fix this anomaly.  MATH数学代写

We will do this by computing the approximation 𝑀̂ = 𝑁𝑊 with the constraint that the entries of must 𝑊 always be greater than or equal to 0, i.e., they must be non -negative. To do so we will use a simple gradient descent algorithm, which minimizes the error ‖𝑀 − 𝑁𝑊‖𝐹2 subject to the constraint that all entries in 𝑊 are non-negative.

3a. Computing a derivative

We define the following error function

where 𝐷 is the number of dimensions (rows) in 𝑀, and 𝑇 is the number of vectors (frames)in 𝑀. Derive the formula for

3b. A Non-Negative Projection

We define the following gradient descent rule to estimate 𝑊. It is an iterative estimate. Let 𝑊0 be the initial estimate of 𝑊 and 𝑊𝑛 the estimate after 𝑛 iterations. We use the following projected gradient update rule

MATH数学代写
MATH数学代写

where is the derivative of 𝐸 with respect to 𝑊 computed at 𝑊 = 𝑊𝑛 , and max(𝑊̂𝑛+1, 0)is a component-wise flooring operation that sets all negative entries in c to 0.

In effect, our feasible set  for values of 𝑊 are 𝑊 ≥ 0, where the symbol ‘≥’ indicates that every element of 𝑊 must be greater than or equal to 0. The algorithm performs a conventional gradient descent update, and projects any solutions that fall outside the feasible set back onto the feasible set through the max operation.

Implement the above algorithm. Initiali ze W to a matrix of all 1s. Run the algorithm for 𝜂 values (0.0001,0.001, 0.01, 0.1). Run 250 iterations in each case. Plot 𝐸 as a function of iteration number 𝑛. Return this plot and the final matrix 𝑊. Also show a plot of best error 𝐸 as a function of 𝜂.

3c. Recreating the music (No points for this one)

For the best 𝜂(which resulted in the lowest error) recreate the music using this transcription as 𝑀̂ = 𝑁𝑊. Resynthesize the music from 𝑀̂. What does it sound like? You may return the resynthesized music to impress us (although we won’t score you on it).

How To Submit  MATH数学代写

You have to submit everything through canvas. Inside “Hw1_template.zip”, the “data” folder contains the notes and music required for Problem 2 and 3. The folders named Problem1, 2, and 3 contain necessary instructions (sometimes for both Python and MATLAB) and MATLAB templates. If you use MATLAB, use these templates. If you use Python, use the Jupyter notebook template for all problems in google collab in the following linkhttps://colab.research.google.com/drive/1N28A0DrqwOO1A8wO7xfFWmB6NPit592Q?usp=sharing

Instructions for MATLAB:

You will submit a zip file containing all the required files specified below. Title your zip file as“HW1_yourJHID.zip”, where ‘yourJHID’ is your JHED ID.

For Problem 1: Write your answers for problem 1 in the doc file titled “Problem_1_answers” inside the folder “Problem1”.

Deliverables: Problem_1_answers.docx

For Problem 2: From the Problem 2 folder, follow the “.m” MATLAB template files and the additional instructions in “matlab_instructions” file.

Deliverables:

problem2a.mat, problem2a_synthesis.wav, problem2b.mat, problem2b_synthesis.wav

For Problem 3: For 3a, write the answer in “Problem_3a_answer.docx” inside the Problem 3 folder. You can write the answer in the doc file, or you can upload picture of handwritten answer titled “Problem_3a_answer”. For 3b and 3c, follow the “.m” MATLAB template files in that folder.

Deliverables:

Problem_3a_answer.docx/.jpg/.png, problem3b_eta_xxx.mat, problem3b_eta_xxx_errorplot.png,problem3b_eta_vs_E.png, polyushka_syn.wav (optional)  MATH数学代写

Instructions for Pyhon:

You will have to use Jupyter Notebook for Python. We provided the template in Google Colab.Instructions are given in the link. You have to submit the specific deliverables mentioned below.Put them inside “results” folder inside the designated problem folder. You have to submit the“ipynb” file and “Hw1_yourJHID.zip” zip file containing the required results or reports. In the text comments on Canvas, put the link to your Google colab notebook with proper permissions.

For Problem 1: Write your answers for problem 1 in the answer cells under “Problem 1: Linear Algebra”. Or you can write your answers for problem 1 in the doc file titled “Problem_1_answers”inside the folder “Problem1” in “Hw1_template.zip”.

Deliverables: Problem_1_answers.docx (if you choose doc)

For Problem 2: The templates are given in the cells under “Problem 2: Projections”. Edit the empty functions and cells. Here all functions and cells require editing except for function “stft”. More instructions are given in “notebook_instructions.pdf” inside folder “Problem 2” in“Hw1_template.zip”.

Deliverables:  MATH数学代写

problem2a.mat, problem2a_synthesis.wav, problem2b.mat, problem2b_synthesis.wav

For Problem 3: The templates are given in the cells under “Problem 3: optimization and nonnegative decomposition”. For 3a, you can write the answer in Notebook or you can upload picture of handwritten answer titled “Problem_3a_answer”.

Deliverables:

Problem_3a_answer.jpg/.png, problem3b_eta_xxx.mat, problem3b_eta_xxx_errorplot.png,

problem3b_eta_vs_E.png, polyushka_syn.wav (optional)

 

更多代写:美国assignment代写  gre代考价格  马来西亚网课代修  留学生Presentation代写  留学生Research paper代写  如何快速写论文

合作平台:essay代写 论文代写 写手招聘 英国留学生代写

MATH数学代写
MATH数学代写

发表回复