Page 1 of 1

Submit individually but work in groups. All your group members can have the same code. New for Milestone 3 1. Upload you

Posted: Tue Jul 12, 2022 8:48 am
by answerhappygod
Submit Individually But Work In Groups All Your Group Members Can Have The Same Code New For Milestone 3 1 Upload You 1
Submit Individually But Work In Groups All Your Group Members Can Have The Same Code New For Milestone 3 1 Upload You 1 (36.05 KiB) Viewed 30 times
Submit Individually But Work In Groups All Your Group Members Can Have The Same Code New For Milestone 3 1 Upload You 2
Submit Individually But Work In Groups All Your Group Members Can Have The Same Code New For Milestone 3 1 Upload You 2 (52.12 KiB) Viewed 30 times
Submit Individually But Work In Groups All Your Group Members Can Have The Same Code New For Milestone 3 1 Upload You 3
Submit Individually But Work In Groups All Your Group Members Can Have The Same Code New For Milestone 3 1 Upload You 3 (40.43 KiB) Viewed 30 times
Submit Individually But Work In Groups All Your Group Members Can Have The Same Code New For Milestone 3 1 Upload You 4
Submit Individually But Work In Groups All Your Group Members Can Have The Same Code New For Milestone 3 1 Upload You 4 (42.3 KiB) Viewed 30 times
Submit individually but work in groups. All your group members can have the same code. New for Milestone 3 1. Upload your code that does the following: a. Draw a target on the picture. (a circle/rectangle/oval etc) b. Assume a speed and angle. c. Show the egg being launched and its path towards the target, just as in Angry Birds d. You must include drag for this milestone. e. Make sure you have an egg or a ball at the front of your path. f. Ask user for speed and angle and incorporate it into you code. g. Establish a point system, where the user scores based on whether they hit the target. Any create efforts will result in extra credit for the project. h. i. Make sure to add a magnet on the way which affects the trajectory. User selects difficulty level which affects how string a magnet you put in place. j. Improve scoring system, it should be (inversely) proportional to error. You may set a cutoff beyond which there will be no points. k. Additional effects will bring extra credit.
clear clc close all % Plotting the target on the interface startmessage = msgbox ('Generate Random Target'); uiwait (startmessage); x3 randi ([10 601,1,1); y3 = randi ([10 30], 1, 1); centers [x3 y3]; radius = 2.5; figure (1) viscircles (centers, radius, 'color', 'r'); xlim ( [0 75]); ylim ( [0 75]); hold on I imread ('angrybirdsbgflip.png'); h image (xlim, ylim, I); uistack (h, 'bottom'); ---User input prompts--- message = msgbox ('Press Ok to Start'); uiwait (message); %--- % Speed Input prompt1= ['Inital Velocity']; dlgtitle1= 'Input Velocity'; dims1 = [1]; speedinput = inputdlg (prompt1); z3 cell2mat (speedinput); ve str2num (z3); % Angle Input
CAN- speedinput = inputdlg (prompt1); z3 = cell2mat (speedinput); v0 = str2num (z3); % Angle Input prompt2 = ['Inital Angle']; dlgtitle2= 'Input Angle'; dims2 = [1]; angleinput z4 = cell2mat tha str2num (z4); x0 = 0; y0 = 0; inputdlg (prompt2); (angleinput); projectile-- % Initial conditions g = 9.81; Cd = 0.3; Launching the m = 5; r = .5; A = pi*r^2; rho 1.225; Fd= .5*rho*Cd*A; score1 = 0; dt = 0.02; tfin = 10; t = 0:dt:tfin; x1 (1) = 0; x2 (1)=v0*cosd (tha) ; y1 (1) = 0; y2 (1) = v0*sind (tha); x1 = zeros (1, 1000); % preallocating for memory y1 = zeros (1, 1000); % preallocating for
x2 (1) y1 (1) = 0; y2 (1) v0*sind (tha) ; x1 = zeros (1, 1000); % preallocating for memory y1 = zeros (1, 1000); % preallocating for memory v0*cosd (tha) ; for n = 1:length(t) x1(n+1) = x1(n) + dt*x2 (n); x2 (n+1) = x2(n) + dt*(- Fd*x2 (n)^2*cosd (tha) /m); y1(n+1)= y1(n) + dt*y2(n); y2 (n+1) = y2(n) + dt*(-g- Fd*y2 (n)^2*sind (tha) /m); centers = [x1(n), y1(n)]; hold on viscircles (centers, r, 'color', 'b'); pause (0.007); viscircles (centers, r, 'color', 'w'); end %--- k = ((x1(n)-x3).^2)+((y1(n)-y3).^2); if y1(n)<-.01 break end if k<10 end Score---- score1 = 1; if score1 == 1 end else msgbox ('You Scored 1 Point!'); msgbox ('Try Again');