This preview shows pages 1–3. 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: 14:440:127 14:440:127 14:440:127 14:440:127 Introduction to Computers for Engineers Recitation 2 Problems for students to attempt SOLUTIONS 1) Write Matlab code that displays You must go to study right away if the variable TVTime equals 10. if(TVTime = = 10) disp(You must go study right away) end 2) Find the number between 15 and 20 with the least number of prime factors (for now, you can enter commands separately for each number from 15 to 20. In later recitations, youll automate this process.) factor(15) ans = [3 5] factor(16) ans = [2 2 2 2] factor(17) ans = [17] factor(18) ans = [2 3 3] factor(19) ans = [19] factor(20) ans = [2 2 5] % If you interpret the question as least number of unique prime factors, 17 and 19. % Otherwise, 16, 17, 18 3) Define a variable x with a numerical value. Write a program to multiply the variable by the numbers 1 through 5. Then comment out the instructions that include multiplying by even numbers. x = 142; x = x*1; % x = x*2; x = x*3; % x = x*4; x = x*5; % Note that this wasnt a great question. 4) (on PSet) 5) Use Matlab to verify the following. Let x = 3/17 * x = 3/17*pi tan(2*x) (2*tan(x))/(1(tan(x))^2) ans = 4.4409e016 % Note that this answer is 10^16, which is approximately 0 but with some rounding error. 6) Create a vector of the even numbers between 3 and 16. First, write this as a row vector....
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
 blase

Click to edit the document details