Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask MATLAB Expert

Exercise 1 This le contains two arrays, A and B. Each of these arrays contains a number of 50  50 grayscale images of faces. The array A contains a library of 20 faces and has size 50  50  20, and the array B contains 4 test faces and has a size 50504. In this exercise, you should be plotting and reshaping these images often to make sure that everything makes sense! You can plot an image in A using the following command:

>> imagesc(A(:,:,1)), colormap gray;
Another nice way to plot is:
>> pcolor((A(:,:,16))), shading interp, colormap(gray), set(gca,'Xtick',[],'Ytick',[])
>> axis ij

(a) Reshape the A array so that it is size 202500 and each row is one of the images. (Be careful if you use the reshape command, since you will want to reshape into a 2500  20 array and then take the transpose!).

(b) Compute the economy sized SVD of the reshaped A matrix.

returned by svd has the singular values on the diagonal.

(c) Images 1   5 of A are all of Clooney, images 6   10 are of Obama, images 11   15 are of Thatcher, and images 16   20 are of Damon. Compute the average face for each of Clooney, Obama, Thatcher, and Damon. Project these onto the eigenface directions obtained above. Recall that since we reshaped images into row vectors, projecting onto eigenface directions is the same as multiplying with the V matrix from the SVD.

(d) Reshape the B array of test images so that it is size 4  2500 (use the same method that you used for array A). Project each of these four test images onto the eigenface directions to obtain four vectors, each of length 20. For each of the test images, compute the distance in eigenface space to the average Clooney, Obama, Thatcher, and Damon faces. Given two vectors f1 and f2 in eigenface space, you may compute the distance using something like: >>
distance = norm(f1-f2);.

Exercise 2 This data contains the velocity (meters/second) as a function of time (seconds). Find the acceleration as a function of time. To do this, you will need to di erentiate the data as a function of time. Do this in the following ways (it is interesting to plot the following approximate derivatives on the same plot to see the various features!):
(a) Use an O(t2) accurate scheme on the raw data. Please use a central di erence on the interior points, and an O(t 2) forward/backward di erence scheme on the end points.

(b) Fit a spline through the data with t=0:0.01:30; and nd the O(t2) and O(t4) derivative (in both cases, use a O(t2) forward/backward di erence scheme at the end points).

(a) Integrate using a trapezoidal rule. Use the cumtrapz command to compute the cumulative integral at each intermediate time.

(b) Use a spline with t=0:0.01:30 and a trapezoidal rule to evaluate the integral. Again, use the cumtrapz command.

(c) Create a function that returns the spline interpolation using function handles. Integrate this function with the quad command from t = 0 to t = 30.

MATLAB, Engineering

  • Category:- MATLAB
  • Reference No.:- M9134785
  • Price:- $50

Priced at Now at $50, Verified Solution

Have any Question?


Related Questions in MATLAB

Question a safe prime is a prime number that can be written

Question : A safe prime is a prime number that can be written in the form 2p + 1 where p is also a prime number. Write a MATLAB script file that finds and displays all safe primes between 1 and 1000.

Prepare a 3 - 10 pages long reportprepare a presentation

Prepare a 3 - 10 pages long report Prepare a presentation with 5 - 9 slides. The slides will include introduction (need and similar work), theoretical background (tested neural networks), Data, Results (Comparison of the ...

Assignment -we have daily gridded rainfall data of 40 years

Assignment - We have daily gridded rainfall data of 40 years and structure of the dataset is like below; Lat = [6.5:0.25:38.5]; Lon = [66.5:0.25:100]; Rainfall (135x129x365x40) (Lon, Lat, days, years). Now, we looking fo ...

Lab assignment - matlab matrix relationallogical operators

Lab Assignment - MATLAB Matrix, Relational/Logical Operators and Plotting This laboratory exercise/assignment will involve you 1) practicing multiplication operators in MATLAB; 2) practicing relational and logical operat ...

Assignment - matlab programmingusing appropriate matlab

Assignment - MatLab Programming Using appropriate MatLab syntax, write the code required to analyse and display the data as per the problem description. The order of the MatLab Program should be as follows: Variables and ...

Recitation problems -1 determine the highest real root of

Recitation Problems - 1. Determine the highest real root of f(x) = 2x 3 - 11.7x 2 + 17.7x - 5 using the Newton-Raphson method with at least four iterations. Start with an initial guess of x 0 = 3. 2. Determine the real r ...

Suppose that a student has the option of enrolling for a

Suppose that a student has the option of enrolling for a single elective during a term. The student must select a course from a limited list of options: "English, " "History, " "Biology, " "Computer, " or "Math." Constru ...

Assignment - matlab programmingusing appropriate matlab

Assignment - MatLab Programming Using appropriate MatLab syntax, write the code required to analyse and display the data as per the problem description. The order of the MatLab Program should be as follows: Variables and ...

Assignment -matlab codes and simulated model in

Assignment - Matlab codes and simulated model in simulink/matlab and truetime. 1. Matlab codes and simulink model for pid controller optimization using particle swarm optimization (PSO) my plant is integer order 1000/(s^ ...

Assignment matlab programmingusing appropriate matlab

Assignment: MatLab Programming Using appropriate MatLab syntax, write the code required to analyse and display the data as per the problem description. The order of the MatLab Program should be as follows: Variables and ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As