487 views

Uploaded by Kevin Peng

- Problems Solution
- Application of Matrices in Real Life
- Matrix
- Diagnostic Test - AP Calculus
- CMSC 405 Homework 4
- LaTeX_Mathematics - Wikibooks, Open Books for an Open World
- Linear Algebra Spring 2015
- Ochi2
- 5th Form 2014 Christmas Long Paper Exama
- New MA125 Course Syllabusrev12!15!1
- 03 RMS Frequency Planning Method
- Math HL Calculator Sheet
- 643267
- Assignment and Basics Functions
- Particulars of Grade Xii
- Mathematics
- Betta
- jt
- correction_tp_f90.pdf
- MODUL A SET 6.doc

You are on page 1of 3

J. Orfanidis This homework set is due online at Sakai no later than 5:00 AM on Monday, October 3, 2011. Please submit the HTML le together with any supporting PNG les generated by MATLABs publish command from your script M-le (alternatively, you may copy-paste from the HTML le into Word, or submit a single MHT le). Late submissions will not be accepted. Please upload your les to Sakai under Assignments for week-3, not to the Drop Box. Please do the following problems: 1. Problems 4.1, 4.6, and 4.11. In particular, for Problem 4.6, use linspace to generate a length-6 vector of pressure values P in the interval [0, 100] kPa. Use meshgrid to generate a 26 array of heights h, expressed in millimeters (note that in metric units you must replace 100 kPa by 100,000 Pa). 2. Consider the matrix: 2 A = 8 5

2 5 6

7 4 1

3 5 8

Using appropriate MATLAB functions do the following, each in a single operation: a. Determine the minima of the columns and their locations. Then, determine the minima of the rows and their locations. Then, repeat for the maxima of the columns and rows. b. Compute the column means and the row means. Compute the column sums and the row sums. Compute the column products and the row products. c. Apply the functions cumsum, cumprod, and diff column-wise, and then, row-wise. d. Sort A column-wise in decreasing order. Then, sort it row-wise in increasing order. e. Replace by zeros the 22 submatrix dened at the intersection of the second and third columns and rows of A. f. Flip the matrix A upside-down. Then, ip it left-right. Determine the matrix B whose rows and columns are the reverse of those of A. Rotate the matrix A clock-wise by 90 deg. Rotate by 90 deg followed by ipping upside down, and compare the result with the transpose of A. g. Replace the main diagonal (i.e., the A11 , A22 , . . . , matrix elements) by zeros. Replace all elements of A by zeros but for the upper-left 22 submatrix. h. Swap the second and fourth columns of A. Swap the rst and third rows of A. i. Rearrange A into a 26 matrix whose elements in each column are taken column-wise from those of A. Similarly, reshape A into a 43 matrix and compare it with the transpose of A. Then, reshape A into a 62 matrix. Finally, reshape A into a 223 three-dimensional array. j. Using the function repmat, replicate A three times horizontally. Then, replicate it two times vertically. Then, replicate it three times horizontally and two times vertically. Re-do these replications without the use of repmat, just by appropriately concatenating A with itself. k. What do the commands, A==5, and, q = nd(A==5), do? With one command, replace all the entries of A that are equal to 5 by the value of 50. Then, with another single command restore their values back to 5. [ Not fully covered yet, but see class notes: week01.pdf, week03.pdf (p.42). ] l. Square every entry of A. Then, take the square root of the result. Compute the matrix, B = log(2*A+3), then, recover A from B. Repeat with, B = log2(2*A+3), and with, B = exp(2*A+3). 3. Consider the Taylor series for the sine function, and its (N+1)-term approximation:

sin(x)=

1

S(x, N)=

a. For N = 30 and the column vector x = [1; 2; 5; 4; 10], use the function ndgrid (or, meshgrid) to provide a fully vectorized computation of S(x, N) as a column vector, and show how to print the formatted table of values:

x sin(x) S(x,N) --------------------------------1.00 0.841471 0.841471 2.00 0.909297 0.909297 -5.00 0.958924 0.958924 4.00 -0.756802 -0.756802 10.00 -0.544021 -0.544021

b. Consider the trigonometric series expansion and the corresponding N-term approximation of the periodic signal f (t)= t(1 t) dened over its basic period 0 t 1:

n=1

sin2 (nt)

n2

S(t, N)=

N n=1

sin2 (nt)

n2

0t1

Using the function linspace, dene t to be a column vector of 101 equally-spaced values in the interval [0, 1], and choose N = 20. Using the function ndgrid (or, meshgrid) provide a fully vectorized computation of S(t, N) as a column vector. On the same graph, plot f (t) and S(t, N) versus t. Repeat with N = 40. c. For the case N = 40 of part (b), plot f (t) and S(t, N) over three periods spanning the time interval 1 t 2. Note that while S(t, N) is manifestly periodic in t, you would need to extend f (t) periodically over these periods (i.e., its values over the basic period [0, 1] are repeated.) 4. Two formulas for calculating are: 9801 (4n)! (1103 + 26390 n) = (n!)4 (396)4n 2 2 n=0

=2 3

The rst one is due to Ramanujan and converges extraordinarily fast. Truncate both series to a maximum number of 10 terms. Dene the vector n = 0 : 9 and using the built-in functions cumsum and factorial create a 103 matrix of the approximation values, as shown below, where the nth entries are computed by using the terms 0 : n. Your computations must be completely vectorized. Moreover, use appropriate MATLAB commands, e.g., the function fprintf, to print your results as in the table below, where the very last row prints itself.

i.e.,

http://en.wikipedia.org/wiki/Pi

http://en.wikipedia.org/wiki/Ramanujan

n f(n) g(n) ----------------------------------------------0 3.1415927300133055 3.4641016151377544 1 3.1415926535897940 3.0792014356780038 2 3.1415926535897931 3.1561814715699539 3 3.1415926535897931 3.1378528915956805 4 3.1415926535897931 3.1426047456630846 5 3.1415926535897931 3.1413087854628832 6 3.1415926535897931 3.1416743126988376 7 3.1415926535897931 3.1415687159417840 8 3.1415926535897931 3.1415997738115058 9 3.1415926535897931 3.1415905109380797 ----------------------------------------------Inf 3.1415926535897931 5. The distance traveled by a uniformly-accelerated object in time t, with initial velocity v and acceleration a, is given by: 1 x = vt + a t2 (1) 2 We wish to compute x for a range of t values and for three different sets of v and a, dened as follows in MATLAB notation: t = 0:10; v = [10, -10, 20]; a = [2, 4, -6]; Using the meshgrid function, dene appropriate 103 meshgrid matrices V, A, T that correspond to the vectors v, a, t, and calculate the corresponding 103 matrix of distances X that implements Eq. (1), vectorized in all three variables v, a, t, and whose three columns represent the x distances for the three cases of v, a. Moreover, use fprintf to display your answers in a table (to be completed by your program) as shown below, in which the last three columns are the entries of the matrix X: --------------------------------v = 10 v = -10 v = 20 t a = 2 a = 4 a = -6 --------------------------------0 0.00 0.00 0.00 1 11.00 -8.00 17.00 2 24.00 -12.00 28.00 ... 10 .... 200.00 .... 100.00 .... -100.00

- Problems SolutionUploaded byDaniel
- Application of Matrices in Real LifeUploaded byCh Ameer Hamza
- MatrixUploaded byZakky Indra Nugroho
- Diagnostic Test - AP CalculusUploaded byShannon Burton
- CMSC 405 Homework 4Uploaded byRichard Mcdaniel
- LaTeX_Mathematics - Wikibooks, Open Books for an Open WorldUploaded bymttal24
- Linear Algebra Spring 2015Uploaded bysofi
- Ochi2Uploaded byEgwuatu Uchenna
- 5th Form 2014 Christmas Long Paper ExamaUploaded byNicholas Jackson
- New MA125 Course Syllabusrev12!15!1Uploaded bynaos23
- 03 RMS Frequency Planning MethodUploaded bysohappy2
- Math HL Calculator SheetUploaded byAbdullah Al Sakib
- 643267Uploaded byYuga Wijaya
- Assignment and Basics FunctionsUploaded byMUHAMMAD DANISH BASHIR
- Particulars of Grade XiiUploaded byAditya Kavuluri
- MathematicsUploaded byAshnaBeeslall
- BettaUploaded byMarcos Jesus Villaseñor Aguilar
- jtUploaded bymankguch@yahoo.com
- correction_tp_f90.pdfUploaded byBassour Salah Eddine
- MODUL A SET 6.docUploaded byMia Shera
- Operators on Pythagorean MatricesUploaded byIOSRjournal
- Algebra EXTRAUploaded byCok Al
- PM Unit 2 - P1 - 2005 JuneUploaded byBJAY K
- Graphics2-MathsPrelimUploaded bysainathsaitowers
- Elemental matrices for Finite element electromagneticsUploaded byftdlaks
- 5. Electrical - IJEEER -Optimal Allocation and Contingency Analysis - KOTA SHIRISHA REDDYUploaded byTJPRC Publications
- Maths Term PaprUploaded byPrince Garg
- Analyzing the Environmental Impact of Transportation in ReengineeredUploaded byMia
- Individual Tracking e i Gen Vec ToUploaded byVanidevi Mani
- modelingUploaded byAbderrahim

- _304401_ Certificate Course Architechtural DraughtsmanUploaded byJayesh Bhgwt
- Reed SolomonUploaded bycalidor
- Math g4 m5 Full ModuleUploaded bypeppylepepper
- 2Uploaded byAwais
- Functions in Variable Formulas _ Tekla User AssistanceUploaded byPepito Perez
- A Robust Filtered-s LMS Algorithm for Nonlinear Active Noise ControlUploaded byAbhishek Aich
- syllabus.pdfUploaded byMohammad Reza Khalili Shoja
- Scientia Magna, Vol. 5, No. 4, 2009Uploaded byAnonymous 0U9j6BLllB
- Produce Reduced and Extended Zone Plot of Band EquationUploaded byTariqul Islam Ponir
- Mathematics CountsUploaded byttrb
- Linear AlgebraUploaded bytudor996285
- Leif LM Presentation m AlgoritmoUploaded byFloren Ardila Alvarado
- [Lifschitz] Foundations of Logic Programming, In Principles of Knowledge Representation, CSLI PublicationsUploaded bySergio Arturo
- abcUploaded byshahid
- 155356 November 2012 Mark Scheme 13Uploaded byAbrar Jahin
- Girsanov, numeraires, and all that.pdfUploaded byLe Hoang Van
- 11_ReservoirSizing_bwUploaded bykato
- C.2 Phase Plane Analysis.pdfUploaded byMd Firoz Alam Khan
- Math CalcuUploaded bykcb26
- Lesson1-5.5.pdfUploaded byProjectlouis
- Forward_Analysis_of_5_DOF_Robot_Manipula.pdfUploaded byWai Phyo Maung
- section1_HW3Uploaded byprachi
- Tessellations Glide ReflectionsUploaded byShashank Sharma
- FINITE DIFFERENCE WENO SCHEMES WITH LAX–WENDROFFUploaded byxuanquilieu
- Assignment 1Uploaded byJean
- 2006MTAP_Grade4Uploaded byClambeaux
- theory 6 silvio luchettiUploaded bySilvio Luchetti
- 08Uploaded byVera Gardasevic Mitrovic
- Ants Straight Line - BrucksteinUploaded bypzizzle1243
- rr311303-operations-researchUploaded bySRINIVASA RAO GANTA