1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
PtichkaEL [24]
3 years ago
8

g % Create a program to plot the motion of the ping pong ball with drag. % The program will take inputs for velocity in m/s and

angle of launch. % note that with a high speed camera I estmated a launch speed for a ping % pong ball could be 30 m/s.
Computers and Technology
1 answer:
Gala2k [10]3 years ago
7 0

Answer:

% Create a program to plot the motion of the ping pong ball with drag.  

% The program will take inputs for velocity in m/s and angle of launch.

% note that with a high speed camera I estmated a launch speed for a ping

% pong ball could be 30 m/s.

clear all

close all

clc

velStart=input('input the initial velocity in m/sec:   ');

angle=20:5:80;

% convert the degrees into radians so MATLAB likes it

values_angle=angle*pi./180;

rangeAngle=length(values_angle);

hold on

%Lines 1 - 14 are fine

for i=1:rangeAngle

% set initial position and time

x=[];

y=[];

time=[];

vel=velStart;

VelocityX=[];

VelocityY=[];

x(1)=0; % meters

y(1)=.001;  % meters

time(1)=0; % seconds

mass=.00247; %kg  ping pong ball .00247 Kg

g=-9.8; % m/sec^2

c=0.0005; % coefficient of drag where Re is between 10^3 and 10^5

% so I can load an array for plotting

% start to increment the motion

 

index=1;

thisAngle=values_angle(i);

velx=vel*cos(thisAngle);

VelocityX(1)=velx;

vely=vel*sin(thisAngle);

VelocityY(1)=vely;

% set a time step

deltaTime=.001; % seconds

height=y(1);

flag=0;

velFinalX = 0;

velFinalY = 0;

%Don't see any issues here

while height>0 % check that the ball has not hit ground yet (1e-3 to speed things up, It hangs because it never leaves this line, check how height is calculated.)

   index = index+1;

   

   % *******************************************************

   % break velocity into its components

   if index == 2

       velx = vel*cos(thisAngle);

       vely = vel*sin(thisAngle);

   else

       velx = velFinalX;

       vely = velFinalY;

   end

   % *******************************************************

   

   

   % *******************************************************

   % use an if/else statement to check to see if the ball is moving  

   % down (negative). If it is, then drag has an opposite sign

   % as gravity in the acceleration formula.  Otherwise gravity

   % and drag have the same sign. Calculate the new acceleration in the y.

   if vely < 0

       adragy = g + (c*vely.^2)/mass;

       velFinalY = vely + adragy.*deltaTime;

   else

       adragy = g - (c*vely.^2)/mass;

       velFinalY = vely + adragy.*deltaTime;

   end

   % *******************************************************

   

   % *******************************************************

   % Now calculate the acceleration in the x .

   adragx = (-c*velx.^2)/mass;

   % *******************************************************

   

   

   % *****************************************************

   % calculate the new velocity at the end of the time step

   % this will have X and Y components, so you need a variable

   % for each.  One is velFinalX and the other is velFinalY.

   velFinalX = velx + adragx.*deltaTime;

%     velFinalY = vely + adragy.*deltaTime;

   % *******************************************************

   

   

   % ******************************************************

   % Get a new velocity vector and angle given the X and Y

   % The velocity is the variable "vel" and angle is "angle"

   vel = sqrt(velFinalX.^2 + velFinalY.^2);

   angle = atan(velFinalY/velFinalX);

   %*******************************************************

   

   % now save my values at this time step

   VelocityX(index)=velFinalX;

   VelocityY(index)=velFinalY;

   

   % and distance numbers

   distX=VelocityX(index).*deltaTime;

   distY=VelocityY(index).*deltaTime;

   

   % save distance values  

   x(index)=x(index-1)+distX;

   y(index)=y(index-1)+distY;

   height=y(index);

   time(index)=time(index-1)+deltaTime;

   %lines 105-107 are good

   if distY<0&&flag<=1

       if height<.25

           disp(distY)

           fprintf('goal height detected at distance %.2f meters.',x(index));

           flag =2;

           LandingDistance(i)=x(index);

       end

   end

   

end

plot(x,y)

title('distance traveled by ping pong ball in meters')

xlabel('horizontal distance traveled (meters)')

ylabel('vertical distance traveled (meters)')

end

hold off

Explanation:

You might be interested in
In this lesson, you learned how to create reports and how to display them in a Web application. You will use the same chinook da
Nimfa-mama [501]

create a report that displays back tge total sales by country

6 0
2 years ago
Which one of the following is not possible to view in the debug logs?
Usimov [2.4K]

Answer:

Formula field calculations

Explanation:

We can use debug logs to track events in our company, these events are generated if active users have trace indicators.

A debug log can register information about database operations, system processes and errors, in addition, we can see Resources used by Apex, Workflow Rules, Assignment Rule, HTTP calls, and Apex errors, validation rules. The only one we cannot see is Formula field calculations.

8 0
3 years ago
Write a 20 charecter poem! for points! :)
umka21 [38]
The sky was blue
Glistening clouds in the air
For the little boy had no clue
His mother sat him down on the warm chair

There’s some great news
Hitler took over
And they killed off the Jews
The little boy just wanted to show mom his 4 leaf clover
7 0
2 years ago
Read 2 more answers
If you are installing separate anti-virus and anti-spyware programs, which should you install first
Vera_Pavlovna [14]
Probably the anti virus, so you don't get a virus from downloading the anti spyware program.
6 0
3 years ago
Differentiate among a color display, gray scale display, and a black-and-white display​
kotykmax [81]

<u>Answer:</u>

<em>Black and white</em>:

It has only two values namely black or white. The white colour in the image will be represented as “white” and other colour part will be displayed as black.

<em>Grey-scale: </em>

Again the white part does not have a change, the black and other coloured items will be displayed in grey.

<em>Coloured image: </em>

It would display the actual colour of the image. The number of colours and shades depends on the original image from where actually it has been shooted and it also depends on the quality of the camera.

4 0
3 years ago
Other questions:
  • White arrows in the middle of the lane indicate whether the lane must __________.
    8·2 answers
  • 1. Write a bash script to create 3 files of different size greater than 1700 kb and less than 1800 kb . The 2. Content of the fi
    9·1 answer
  • What do yo need to do for device manager to display nonpresent devices?
    9·1 answer
  • Kim is creating a PowerPoint
    13·1 answer
  • An organization's Finance Director is convinced special malware is responsible for targeting and infecting the finance departmen
    13·1 answer
  • Write a public static method named evens that takes in 1 argument int a, and returns a String containing all positive even numbe
    8·1 answer
  • Which software manages the functioning of the entire computer system<br>​
    7·2 answers
  • Tiền tệ ra đời là kết quả
    7·2 answers
  • Your customer said that understanding the directions is difficult. This is an aspect of
    6·1 answer
  • In how many positions are there nucleotide differences between your query sequence and the sequence of accession AY259214.1
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!