CH_8_Scripts

CH_8_Scripts - CH 8 Scripts (1) % % % % % % Colors in the...

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

View Full Document Right Arrow Icon
CH 8 Scripts (1) % % Colors in the figures in the text % were modified using the figure % edit commands in the figure window % tool bar. % dt = 0.1; g = 9.8; u = 60; ang = input( 'Launch angle in degrees: ' ); ang = ang * pi / 180; % convert to radians xp = zeros(1); yp = zeros(1); % initialize y = 0; t = 0; i = 1; % initial vector subscript while y >= 0 t = t + dt; i = i + 1; y = u * sin(ang) * t - g * t^2 / 2; if y >= 0 xp(i) = u * cos(ang) * t; yp(i) = y; end end plot(xp, yp,'k'),grid (2) % % This creates a menu GUI % You delete "Menu" by clicking % on the "Quit" button. % k = 0; while k ~= 3 k = menu( 'Click on your option', 'Do this', . .. 'Do that', 'Quit' ); if k == 1 disp( 'Do this . .. press any key to continue . ..' ) pause elseif k == 2 disp( 'Do that . .. press any key to continue . ..' ) pause end end; (3) % % Section 8.2.1 in the text. % matnum = floor(100 * rand + 1); guess = input( 'Your guess please: ' ); load splat while guess ~= matnum sound(y, Fs)
Background image of page 1

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

View Full DocumentRight Arrow Icon
if guess > matnum disp( 'Too high' )
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 11/06/2011 for the course HANDOUT 502 at USC.

Page1 / 3

CH_8_Scripts - CH 8 Scripts (1) % % % % % % Colors in the...

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

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