MATH LAB HELP Program this equation using matlab for loops A

MATH LAB HELP!

Program this equation using matlab for loops: A ball is dropped from a building with height, H meters. The ball is started at rest and release at t=0s. a) Use matlab’s for loops, plot: Displacement vs. velocity graph displacement vs. time graph Velocity vs. time graph b) If the ball hit the ground when it reach its velocity = 30 m/s, and it bounce back once Plot its velocity vs. time graph and displacement vs time graph

Solution

function [d1,v1]=ball(t1,t2)
%Part a

for time=1:1:t1
    v1(time)=9.8*time;%Velocity
    d1(time)=v1(time)*time;%Displacement
end
subplot(2,2,1)
plot(d1,v1)
xlabel(\'displacement\')
ylabel(\'velocity\')
title(\'Subplot 1: displacement vs velocity\')
subplot(2,2,2)
plot(d1,[1:1:t1])
xlabel(\'displacement\')
ylabel(\'time\')
title(\'Subplot 2: displacement vs time\')
subplot(2,2,3)
plot(v1,[1:1:t1]);
xlabel(\'velocity\')
ylabel(\'time\')
title(\'Subplot 3: velocity vs time\')

%Part b
for time=1:1:t2
    v2(time)=30*time-(1/2)*9.8*time*time;%Velocity
    d2(time)=v2(time)*time;%Displacement
end
figure
subplot(2,1,1)
plot(v2,[1:1:t2])
xlabel(\'velocity\')
ylabel(\'time\')
title(\'Subplot 1: velocity vs time\')
subplot(2,1,2)
plot(d2,[1:1:t2]);
xlabel(\'displacement\')
ylabel(\'time\')
title(\'Subplot 2: displacement vs time\')
end

MATH LAB HELP! Program this equation using matlab for loops: A ball is dropped from a building with height, H meters. The ball is started at rest and release at

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site