CEE 170 UCI Homework 3

Embed Size (px)

Citation preview

  • 7/23/2019 CEE 170 UCI Homework 3

    1/3

    Cristen Alvarez CEE 170, Section 4 10/21/15

    Matlab HW #3

    functionf = ode_right(t,y,g,Re_data,cd_data,nu,d,rho_a,A,m)

    Re=abs(y(1))*d/nu;cd=interp1(Re_data,cd_data,Re);

    f(1,:)=g!"#*cd*A*rho_a/m*y(1)*abs(y(1));f($,:)= y(1);f=f(:);

    c%cc%ear

    &'arameter a%uesg = "1; &gra+itationa% constant m/s$

    d = !"!1; &diamater of sphere mrho_- = 1!!!; &density of -ater .g/mrho_a = 1"$; &density of air .g/m0 = $"2; &specific gra+ity of spherecd = !"; &drag coefficientm = 0*rho_-*3/*pi*(d/$); &mass of sphere .gA = pi*d$/3; &crosssectiona% area of sphere m$nu = 1"#e#; &+iscosity of air

    &4ode% 'arametersdt = !"!1;tspan = !:dt:#;! = !;5! = 1!!;6! = 7!; 5!8;tstop = 9;

    &initia% +e%ocity initia% height

    =%oad(

  • 7/23/2019 CEE 170 UCI Homework 3

    2/3

    Cristen Alvarez CEE 170, Section 4 10/21/15

    &Dermina% e%ocity_termina% = sGrt($*m*g/(cd*rho_a*A))

    &Approimate time -hen reached Dermina% e%ocity. = !;

    tt= !;fori = 1:%ength(6out) . = (6out(i) F _termina%)/_termina%; if. H !"!1 tt = Dout(i); brea. endendDime_termina% = tt

    &'%ot e%ocity +s Dime raphsubp%ot($,1,1)p%ot(Dout,6out(:,1),

  • 7/23/2019 CEE 170 UCI Homework 3

    3/3

    Cristen Alvarez CEE 170, Section 4 10/21/15

    !e ball reac!es ter*inal velocit" +!en it !its t!e ro-n.