MATLAB PROGRAM AND FUNCTIONS

QUESTION

Diam Mass Alpha V Cd Range (X) data (Y) data

0.2

0.4

48

8

0.2

5.979

1.05

2.08

3.10

4.11

5.10

0.97

1.53

1.70

1.48

 

(The data of the assignment)

SOLUTION

1.(a)

 

……………………………………………(1)

ρπ

……………………………..(2)

 

………………………………(3)

 

……………………………………………..(4)

 

Comparing above two equations(3) and (4),

 

………………………………………(5)

 

By,

…………………………………………………(6)

 

By equations (1),(4) and (6),

 

……………………….(7)

 

Putting the values,

 

………………………..(8)

 

By,

………………………………….(9)

 

By equations (8) and (9),for football on decending,

 

 

 

 

..(10)

 

Equations (9) and (10) confirm mathematical model.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

1(b). CODE—%For terminal conditions,

function [value,isterminal,dircn]=func(t,z,flag);

g=9.81;

if nargin<3 | isempty(flag)

value = [z(2);0;z(4);-g];

else

switch flag

case ‘events’

value=z(3);

isterminal=1;

dircn= -1;

otherwise

error(‘function not programmed for this event’);

end

end

Next .m file,

 

tspan=[0 2];

vo=8;alpha=48.*pi./180;

zo=[0;vo.*cos(alpha);0;vo.*sin(alpha)];

options=odeset(‘events’,’on’);

[t,z,te,ze,ie]=ode45(‘func’,tspan,zo,options);

x=z(:,1);y=z(:,3);

plot(x,y);axis(‘equal’);

xlabel(‘x’);ylabel(‘y’);

title(‘projectile trajectory’);

print;

 

 

 

 

Range (xvalue)= 6.4882m

Time of flight= 1.2121s

 

 

 

 

 

 

 

 

 

 

 

 

 

 

1(c)= CODE—

 

xi=[1.05;2.08];yi=[3.10;4.11];

u=1:1:10;

z=interp1(xi,yi,u);

plot(xi,yi,’o’);

xlabel(‘x’);

ylabel(‘y’);

 

 

 

 

 

 

 

This is the curve in quadratic fitting.Here equations are for varying y with positive x^2.In projectile motion,there exist newton’s laws and there is a variation of y with time t and negative of g(gravity).x is prportinal to x component of velocity.Solving we get a quadratic equation in x with negative x^2.

 

 

1(d)  CODE—

 

x=1.05:0.01:2.08;

t=0:0.2:2;

alpha=48.*pi./180;

rho=1.225;d=0.2;m=0.4;g=9.81;Cd=0.2;vo=8;

k=(1/2).*Cd.*rho.*pi.*((d./2)^2)./m;

zo=[0;vo.*cos(alpha);0;vo.*sin(alpha)];

options=odeset(‘events’,’on’);

[t,z,te,ze,ie]=ode45(‘func’,tspan,zo,options);

str=[‘z(2)=’ num2str(z(2)) ];

disp(str);

vo1=(z(2))./(cos(alpha));

str1=[‘vo1= ‘ num2str(vo1) ];

disp(str1);

f=k.*m.*(abs((vo.*cos(alpha))+(vo.*sin(alpha)))).^2;

vx=vo1.*cos(alpha);

vy=vo1.*sin(alpha);

cd1=Cd.*f./(k.*m.*(abs(vx.*vx+vy.*vy).^2));

str3=[‘cd1= ‘ num2str(cd1) ];

disp(str3);

 

 

Output—

 

vo1= 6.7602e-005

cd1= 1222426139041740500

JD45

“The presented piece of writing is a good example how the academic paper should be written. However, the text can’t be used as a part of your own and submitted to your professor – it will be considered as plagiarism.

But you can order it from our service and receive complete high-quality custom paper.  Our service offers Maths essay sample that was written by professional writer. If you like one, you have an opportunity to buy a similar paper. Any of the academic papers will be written from scratch, according to all customers’ specifications, expectations and highest standards.”

order-now-new                   chat-new (1)