Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Matlab code used for vehicle dynamics

  1. Jan 31, 2012 #1
    Please help me recognize what is wrong with this professor supplied code...

    clear all
    options=odeset('events', @events_passing)
    [t,z]=ode45(@passing,[0,10],[0,50*88/60],options)
    plot(t,z)

    function [value,isterminal,direction]=events_passing(t,z)
    value=z(2)-88;
    isterminal=1;
    direction=0;
    end


    %Gillespie Data Page32
    function torque=engine_gillespie(omega)
    torque_coeff =[-1.5752e-006 7.9768e-004 1.8454e-001 9.9834e+001];
    torque=polyval(torque_coeff,omega);

    function f=passing(t,z)
    f=zeros(2,1);
    x=z(1);
    v=z(2);
    g=32.2;
    M=2500/g;
    I_e=0.8/12;
    I_t=0.5/12;
    I_d=1.2/12;
    I_w=11/12;
    N_t=1.36;
    N_f=2.92;
    N_tf=N_t*N_f;
    Re=12.59/12;
    rho=0.00236;
    c_d=0.32;
    A=20;
    f0=0.015;


    M_r=(I_e+I_t)*N_tf^2/Re^2+I_d*N_f^2/Re^2+4*I_w/Re^2;
    M_equivalent=M+M_r;

    dvdt=(engine_gillespie(v*N_tf/Re)*N_tf/Re-f0*M*g-0.5*rho*A*c_d*v^2-M*g*sin(atan(.02)))/M_equivalent;
    f(1)=v;
    f(2)=dvdt;
     
  2. jcsd
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Can you offer guidance or do you also need help?
Draft saved Draft deleted



Similar Discussions: Matlab code used for vehicle dynamics
  1. Matlab codes (Replies: 2)

  2. Matlab code (Replies: 0)

  3. Error code in Matlab (Replies: 3)

Loading...