How to show Kinetic energy,potential energy at given ditance

7 Ansichten (letzte 30 Tage)
thush solid
thush solid am 15 Nov. 2022
Kommentiert: Alan Stevens am 17 Nov. 2022
clc;
% Data Taken from given projectile phots and vedios
%Flight time(seconds) is calculated using vedio real time
% Angle(degree) is measured using photo when projectile lanching
% height(m) is calculated as disatnce between ground and projectile
% Flight time = Tf
% Angle = theta
Tf=20;
theta=60;
height=5000;
g=9.81;
velocity=(g*Tf)/(2*sind(theta));
figure;
hold on;
xlabel('Horizontal Distance (m)');
ylabel('Vertical Distance (m)');
title('Projectile Motion');
c=1;
for height= [5000]
for angle= [45]
[maxHeight(c),horDist(c)]=projMotion(velocity,height,angle);
c=c+1;
end
end
function [maxHeight,horDist] = projMotion(velocity,height,angle)
Vyi=velocity*sind(angle);
Vxi=velocity*cosd(angle);
g=9.81;
tmax=(2*Vyi/g+sqrt((2*Vyi/g)^2+8*height/g))/2;
horDist=tmax*Vxi;%calculates horizontal distance when hits ground==0 height
maxHeight=height+Vyi*(Vyi/g)-.5*g*(Vyi/g).^2;%calculates max height
t=0:.001:tmax;
d=height+Vyi*t-.5*g*t.^2;
%horDist=tmax*Vxi
plot(Vxi*t,d,"--+R");
%plot(horDist,maxHeight,"--+R");
horDist=tmax*Vxi;
Hittingvelocity=sqrt((velocity*sind(angle)-g*tmax).^2+(velocity*cosd(angle)).^2);
tmax;
%sprintf(horDist,d)
%finding Energy KE,PE
% PE potential energy
% KE kinetic Energy
% mass of projectile
m=10;
PE=m*g*d;
Vy=Vyi-g*t;
KE=0.5*m*(Vxi.^2+Vy.^2);
TE=PE+KE;
%in this projectile i want to show KE,PE
end

Antworten (1)

Alan Stevens
Alan Stevens am 15 Nov. 2022
Bearbeitet: Alan Stevens am 15 Nov. 2022
Do you mean something like this:
Tf=20;
theta=60;
height=5000;
angle = 45;
g=9.81;
velocity=(g*Tf)/(2*sind(theta));
figure;
hold on;
xlabel('Horizontal Distance (m)');
ylabel('Vertical Distance (m)');
title('Projectile Motion');
Vyi=velocity*sind(angle);
Vxi=velocity*cosd(angle);
tmax=(2*Vyi/g+sqrt((2*Vyi/g)^2+8*height/g))/2;
horDist=tmax*Vxi;%calculates horizontal distance when hits ground==0 height
maxHeight=height+Vyi*(Vyi/g)-.5*g*(Vyi/g).^2;%calculates max height
t=0:.001:tmax;
d=height+Vyi*t-.5*g*t.^2;
%horDist=tmax*Vxi
plot(Vxi*t,d,"--+R"), grid
m=10;
PE=m*g*d;
Vy=Vyi-g*t;
KE=0.5*m*(Vxi.^2+Vy.^2);
figure
plot(t, PE, 'r', t, KE, 'b'), grid
xlabel('time'), ylabel('Energies')
legend('PE', 'KE')
Replace
plot(t, PE, 'r', t, KE, 'b'), grid
by
plot(Vxi*t, PE, 'r', Vxi*t, KE, 'b'), grid
if you want the plot against horizontal distance instead of time.
  2 Kommentare
thush solid
thush solid am 16 Nov. 2022
i want to. plot it with respect horizontal distance with given interval and also i want to show enegy values on plot
Alan Stevens
Alan Stevens am 17 Nov. 2022
Re: Plot against horizontal distance - see the end of my previous reply.
Re; Energy values - they are shown on the y-axis.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Gravitation, Cosmology & Astrophysics finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by