Difference between revisions of "User:Arc32"

From PrattWiki
Jump to navigation Jump to search
 
Line 9: Line 9:
 
=='''Favorite Demonstration'''==
 
=='''Favorite Demonstration'''==
 
My favorite demo is "Viewing a Penny". I think it's really cool that you can use MATLAB to graph different curves and create a complicated graphic that is so accurate.
 
My favorite demo is "Viewing a Penny". I think it's really cool that you can use MATLAB to graph different curves and create a complicated graphic that is so accurate.
 +
 +
 +
tester code by Behringer for physics 61
 +
 +
 +
function drag(v,tf,muin)
 +
global m g mu
 +
    h0 = 0;          % initial height in m
 +
    v0 = v;          % initial velocity up in m/s
 +
    m  = 1;          % mass in kg
 +
    g  = 9.81;      % acceleration due to gravity in m/s/s
 +
 +
    mu = muin;      % set global drag coefficient from input
 +
 +
    tspan = [0 tf];  % time span in seconds
 +
    y0=[h0;v0];
 +
 +
    % Controls for ODE solver.  Use ode45 for matlab, ode54 for octave with
 +
    % odepkg installed.
 +
    options = odeset('RelTol',1e-6,'AbsTol',1e-6,'InitialStep',0.1,'MaxStep',0.1);
 +
    % [t,y]=ode54(@eom,tspan,y0,options);
 +
    [t,y]=ode45(@eom,tspan,y0,options);
 +
 
 +
    figure(1);
 +
    clf;
 +
    hold on;
 +
    % draw x-axis for reference.
 +
    plot(t,zeros(length(t)),'k');
 +
    % plot y(t)
 +
    plot(t,y(:,1),'g');
 +
    % Mark at t = 4 as "target".
 +
    tt = 4.*ones(2);
 +
    ty = [0 1];
 +
    plot(tt,ty,'-k');
 +
    % labels, legend.
 +
    xlabel('Time (s)');
 +
    ylabel('Height (m)');
 +
    legend('Ball','(Surface of Earth)',0);
 +
    title('Height of Ball vs. Time');
 +
    hold off;
 +
 +
% This equation of motion is appropriate for a turbulent drag force of
 +
% F = - mu v^2, formulated in such a way that it always opposes the
 +
% direction of v.
 +
function dydt=eom(t,y)
 +
global m g mu
 +
 +
dydt=[y(2)
 +
      -g - mu*y(2)*abs(y(2))];

Latest revision as of 04:01, 29 February 2012

Abby Carignan

Name Pronunciation

Abby Carignan. Abby is pronounced "Ah-bee"--as if you combined the words apple and bee. My last name is pronounced rather phenetically--"Cuh-rig-nin" with the stress on the rig (but not too strongly...)

Grand Challenges of Engineering

UN in call for basic sanitation , BBC Mobile News, updated July 17, 2008, accessed September 17, 2011 (Provide access to clean water)

Favorite Demonstration

My favorite demo is "Viewing a Penny". I think it's really cool that you can use MATLAB to graph different curves and create a complicated graphic that is so accurate.


tester code by Behringer for physics 61


function drag(v,tf,muin) global m g mu

   h0 = 0;          % initial height in m
   v0 = v;          % initial velocity up in m/s
   m  = 1;          % mass in kg 
   g  = 9.81;       % acceleration due to gravity in m/s/s
   mu = muin;       % set global drag coefficient from input
   tspan = [0 tf];  % time span in seconds
   y0=[h0;v0];
   % Controls for ODE solver.  Use ode45 for matlab, ode54 for octave with
   % odepkg installed.
   options = odeset('RelTol',1e-6,'AbsTol',1e-6,'InitialStep',0.1,'MaxStep',0.1);
   % [t,y]=ode54(@eom,tspan,y0,options);
   [t,y]=ode45(@eom,tspan,y0,options);
  
   figure(1);
   clf;
   hold on;
   % draw x-axis for reference.
   plot(t,zeros(length(t)),'k');
   % plot y(t)
   plot(t,y(:,1),'g');
   % Mark at t = 4 as "target".
   tt = 4.*ones(2);
   ty = [0 1];
   plot(tt,ty,'-k');
   % labels, legend.
   xlabel('Time (s)');
   ylabel('Height (m)');
   legend('Ball','(Surface of Earth)',0);
   title('Height of Ball vs. Time');
   hold off;

% This equation of motion is appropriate for a turbulent drag force of % F = - mu v^2, formulated in such a way that it always opposes the % direction of v. function dydt=eom(t,y) global m g mu

dydt=[y(2)

     -g - mu*y(2)*abs(y(2))];