gliders - %Case I with drag %Set initial conditions v0=1;...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
%Bryan Choquette %ME 082 %Assignment 7 part II %Create plots of the flightpaths with and without drag clc clear all %Case I %Set initial conditions v0=1; theta0=pi/2; x0=0; y0=0; w0=[v0 theta0 x0 y0]; %set time span timespan=0:.1:10; %solve the ODE [t,w]=ode45('glider_no_drag',timespan,w0); %Set values to x and y x=w(:,3); y=w(:,4); %Plot Y vs. X figure(1) hold on plot(x,y) grid on axis([-1 1.5 -1 1]) title('Fig 1: Glider flight path, Y vs. X, D=0(no drag).') xlabel('X, nondimensional x coordinate') ylabel('Y, nondimensional y coordinate') hold off %Case II %Set initial conditions v02=.1; theta02=0; w02=[v02 theta02 x0 y0]; %Set timespan timespan=0:.1:10; %Solve ODE [t,z]=ode45('glider_no_drag',timespan,w02); %Set values for x and y for case II x2=z(:,3); y2=z(:,4); %Plot Y vs. X for case II figure(2) plot(x2,y2) grid on axis([0 6 -2 .5]) title('Fig 2: Glider flight path, Y vs. X, D=0(no drag).') xlabel('X, nondimensional x coordinate') ylabel('Y, nondimensional y coordinate')
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: %Case I with drag %Set initial conditions v0=1; theta0=pi/2; x0=0; y0=0; w0=[v0 theta0 x0 y0]; %set time span timespan=0:.1:10; %solve the ODE [t,w]=ode45('glider_drag',timespan,w0); %Set values to x and y x=w(:,3); y=w(:,4); %Plot Y vs. X figure(3) plot(x,y) grid on axis([-1 1.5 -1 1]) title('Fig 1: Glider flight path, Y vs. X, D=.01.') xlabel('X, nondimensional x coordinate') ylabel('Y, nondimensional y coordinate') %Case II %Set initial conditions v02=.1; theta02=0; w02=[v02 theta02 x0 y0]; %Set timespan timespan=0:.1:10; %Solve ODE [t,z]=ode45('glider_drag',timespan,w02); %Set values for x and y for case II x2=z(:,3); y2=z(:,4); %Plot Y vs. X for case II figure(4) plot(x2,y2) grid on axis([0 6 -2 .5]) title('Fig 2: Glider flight path, Y vs. X, D=.01.') xlabel('X, nondimensional x coordinate') ylabel('Y, nondimensional y coordinate')...
View Full Document

Page1 / 2

gliders - %Case I with drag %Set initial conditions v0=1;...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online