{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

test02-spring08

test02-spring08 - Prof Johnson 3(25 Points 3D Line Plot A...

This preview shows pages 1–2. Sign up to view the full content.

CSC 110: Engineering Computation with Matlab Test 2 – Spring 08 Prof. Johnson 1. (25 Points) Input/Output: Write a script that reads in the following text file 1, 2, 3, 4, 5, 6, 7, 10, 23, 34, 59, 60, 70, 80, 100, 1, 2, 4, 7 and changes the value of every number that is between 45 and 65 with the number 25, and then write the new set of numbers to a file call “Temp2.txt”. ( Don’t manually change numbers, use a for loop ) Temp2.txt should look like 1, 2, 3, 4, 5, 6, 7, 10, 23, 34, 25, 25, 70, 80, 100, 1, 2, 4, 7 2. (25 Points) Recursion: Write a recursive function called “mysum” that takes in the value “n” as input and returns “y” evaluated as the following: n x x x x y 9 2 ) 2 ( You may assume that n is an integer that is greater than 8 Temp.txt Temp2.txt

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
CSC 110: Engineering Computation with Matlab Test 2 – Spring 08
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Prof. Johnson 3. (25 Points) 3D Line Plot: A 3D line segment between points ) , , ( 1 1 1 1 z y x p and ) , , ( 2 2 2 2 z y x p is define by the following three equations ) ( ) ( ) ( 1 2 2 1 2 2 1 2 1 z z t z z y y t y y x x t x x where t is from 0 to 1. When t =0 you are at point 1 and when t = 1 you are at point 2. Write a script that will plot the 3D line segment between points (10,15,20) and (25, 78, 90). The value of t should go from 0 to 1, with a spacing of 0.5. 4. (25 points) Linear: Given the points (10,15) and (25,30) in an xy coordinate system, (a) Write a script that uses linear interpolation to find the corresponding y-value of x = 22.5 (b) Write a script that uses linear regression to find the corresponding y-value of x = 22.5...
View Full Document

{[ snackBarMessage ]}

Page1 / 2

test02-spring08 - Prof Johnson 3(25 Points 3D Line Plot A...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online