HW 8 - c) A=rand(1,1000); tic for i=1:1000 A(i)=A(i)^2 end...

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

View Full Document Right Arrow Icon
#1 x_calc(1:11)=0; t=[0 0.2041 0.4082 0.6122 0.8163 1.0204 1.2245 1.4286 1.6326 1.8367 2.0408]; for i=1:11 x_calc(i)=-4.95*t(i)^2+10.0*t(i)+0.0063; %the last calculated value was <0 %the projectile hit the ground before t=2.04 %you should not the "x_calc" equation for large values of t end rho=1.2; g=9.8; rel_pres= rho*g*(5.0609-x_calc); plot(x_calc,rel_pres, 'k.' ); #2 a) A=rand(1,100000); tic A=A.^2; toc %time about 0.0006s b) A=rand(1,100000); tic for i=1:100000 A(i)=A(i)^2; end toc %time about 0.1s
Background image of page 1

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

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: c) A=rand(1,1000); tic for i=1:1000 A(i)=A(i)^2 end toc %time about 6.0s A=rand(1,1000); tic for i=1:1000 A(i)=A(i)^2; end A toc %time about 0.027s d) tic A=sin(.3); B=rand(1,1000); for i=1:1000 C=B+sin(.3); end toc %time about 0.0036s tic for i=1:1000 D=A+B; end toc %time about 0.0029s #3 *For each of the 3 colors there are 256 possible “brightness” values. Excluding pure white and black there are then 256^3-2= 16777214...
View Full Document

This note was uploaded on 04/28/2008 for the course GEEN 1300 taught by Professor Degrazia,j during the Spring '08 term at Colorado.

Page1 / 2

HW 8 - c) A=rand(1,1000); tic for i=1:1000 A(i)=A(i)^2 end...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online