Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Hello. I need help on part c of this problem. We are using matlab and are expect

ID: 3682456 • Letter: H

Question

Hello. I need help on part c of this problem.

We are using matlab and are expected to use the find function.

For instance, for part b,

I wrote something like

heightA= find(h>=15 & v<=36);

heightA_start=t(heightA(1));

heightA_end=t(heightA(end));

fprintf('The times when height >=15 and speed<=36 are from %6.2f to %6.2f', heightA_start, heightA_end);

For part c though, the times are from in two blocks like 0 sec to 1 sec and 3 sec to 5sec (Just made them up.)

How do I code for this??

Thank you

Explanation / Answer

clear; %input parameters v0=input('Enter the muzzle velocity (m/s) '); theta=input('Enter the quadrant elevation (degrees) '); %T0=input('Enter the value for the ground temperature in degreees '); %T0=T0+275.16; b2bym0=4e-5; g=9.8; dt=1e-2; %define initial conditions x0=0; y0=0; vx0=v0*cosd(theta); vy0=v0*sind(theta); fdragx=-b2bym0*v0*vx0; fdragy=-b2bym0*v0*vy0; n=1000; %iterations %Tratio=(T0/300)^(2.5); %define data array %t=zeros(1000); x=zeros(1000); %x-position y=zeros(1000); %y-position vx=zeros(1000); %x-velocity vy=zeros(1000); %y-velocity for i=1:n t(i)=i*dt; vx(i)=vx0+fdragx*dt; vy(i)=vy0+fdragy*dt; x(i)=x0+vx(i)*dt; y(i)=y0+vy(i)*dt; x0=x(i); y0=y(i); vx0=vx(i); vy0=vy(i); end plot(x,y,'g+')