How do I add the Magnus Effect Equation into this Code?
조회 수: 10 (최근 30일)
이전 댓글 표시
This is similar to my last homework where we just had to take into account the air drag of a baseball. Now we have to include the magnus effect into that as well for a 2 dimensional space.
Basically, I'm confused because the Magnus Effect has a cross product in it:
Fm = m*Cl*(w X v)
Where,
m is mass
Cl is lift coefficient
w is angular velocity vector
v is velocity vector
Thereforce I'll get a force vector. I just took the magnitude of that vector and added it to my acceleration equation which is making the ball fly 7000m into the air which is obviously wrong. I'm just not really sure how to deal with it.
%Homework #5 The Magnus Effect
close all
clear
clc
%Define Baseball Constants
m = 0.145; %Mass of Baseball in kg
d = 0.075; %Diameter of Baseball in meters
A = (pi/4)*d^2; %Cross-sectional area of baseball in m^2
vxi = 40.2336; %Initial speed in the x direction
vyi = 0; %Initial speed in the y directon
rot = 2000*((2*pi)/60); %Rotational speed of the baseball in rad/s
p0 = 1.23; %Density of air at sea-level in kg/m^3
Cl = 0.15; %Lift Coefficient
yi = 1; %Initial position in y
xi = 0; %Initial position in x
ti = 0; %Initial time
g = 9.81; %Acceleration due to gravity
Cd = 0.35; %Drag coefficient
omega = [1 1 rot]; %Angular velocity vector
v = [vxi vyi 1]; %Velocity vector of the ball
%Define timestep and start counter
dt = 0.001;
i = 1;
while ti < 15
%Define dxdt
dxdt = vxi; %Changes variable for velocity in x direction
dydt = vyi; %Changes variable for velocity in y direction
ME = Cl*cross(omega,v);
meMag = sqrt(ME(1)^2 + ME(2)^2 + ME(3)^2);
%Compute dvxdt and dvydt
dvxdt = (((-0.5*Cd*A.*p0)/m).*dxdt.^2); %Defines decceleration by air drag in the x direction
dvydt = -g - (((0.5*Cd*A.*p0)/m).*dydt.^2) + meMag; %Defines Decceleration by gravity and air drag in the y direction
%Compute vxf and vhf
vxf = vxi + dvxdt*dt; %Defines velocity in the x direction
vyf = vyi + dvydt*dt; %Defines velocity in the y direction
%Compute xf and hf
xf = xi + dxdt*dt - (1/2)*dvxdt*(dt)^2; %Defines Position in the x direction
yf = yi + dydt*dt - (1/2)*dvydt*(dt)^2; %Defines Position in the y direction
%Update time
tf = ti + dt;
%Redefine xi, hi, vxi, vhi, and ti
ti = tf;
vxi = vxf;
vyi = vyf;
xi = xf;
yi = yf;
%Store everything for plotting
T(i) = ti;
X(i) = xi;
Y(i) = yi;
%Update Counter
i = i + 1;
end
plot(X,Y)
title('Trajectory of a Rotating Baseball');
xlabel('Horizontal distance of the ball in meters');
ylabel('Height of the ball in meters');
댓글 수: 3
David Goodmanson
2020년 4월 16일
Well, using the mass of the ball makes no sense. The Magnus force arises from the ball's interaction with the air due to its velocity and its spin. In that regard it is similar to the air drag force, which depends on the ball's size but certainly not its mass. For air drag you do divide by the mass of the ball to get the acceleration, but the air drag force itself has nothing to do with the mass of the ball. So for Magnus you should look for some other mass.
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Multibody Dynamics에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!