This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: Now, write Matlab code that calculates the 3 largest numbers (and their locations) in the vector b , and then displays the following statement using fprintf: "The largest number is 98, which is element 51. The second largest number is 96, which is element 29. The third largest number is 98, which is element 40." (In the event of a tie, the location of those elements can be switched; it doesn't matter which comes first) The same code you write to solve this problem must work, without any modifications, if you instead run the following first: rand( 'state' , 2 ) ; b = round( 100*rand(1,100) ) Computer Question 4: Plotting a surface For both x and y running from 0 to 50 (in increments of 1), display the following 3-D surface using the surf command: z = x + cos(x) + y 2 /50 Turn the grid on. Your surface should look something like this:...
View Full Document
This note was uploaded on 02/29/2012 for the course 440 127 taught by Professor Blase during the Fall '09 term at Rutgers.
- Fall '09