how to visualize my code.

1 view (last 30 days)
Lim Miso
Lim Miso on 8 Dec 2015
Edited: Lim Miso on 9 Dec 2015
I made some code about FreeFall from Physics.
I compleded coding with numbers clearly.
The problem is that i do not know how to visualize this code properly.
I just can make linear line to visualize my code.
I want to make a moving box following my parabolic.
Also, i want to make small airplane following the horizontal line.
I tried to use SET command but i do not know how it works.
Thanks.

Answers (1)

Chad Greene
Chad Greene on 8 Dec 2015
It's hard to understand exactly what you're looking for. It might help to upload a hand-drawn picture of what you want to create and upload some sample data for us to work with. This should solve the airplane bit.
Also a heads-up: some folks on this forum bristle at "send-it-to-me" requests because the forum is supposed to be for everyone to learn from. It's a subtle difference, but sending code directly by email feels less like community learning and more like free consulting.
  3 Comments
Lim Miso
Lim Miso on 8 Dec 2015
function userinput
% Making a Target
clf
TargetCenter=floor(rand(1)*100); TargetHigh=TargetCenter+10;
plot([TargetCenter TargetHigh], [0 0],'m') axis([-10 110 0 100])
hold on
% UserInput
while 1 % velocity v=input('Velocity(m/s): ');
%Height
H=50;
% g
g=9.81;
% time
t=sqrt(2*H/g);
% time interval
dt=0.3;
%
R0=v*t;
for x=0:dt:R0
%want to be a moving box!
y=-9.8/(2*v.^2)*x.^2+50;
plot(x,y);
% want to be in the shape of an airplane
y=50;
plot(x,y);
drawnow;
end
if R0>=TargetCenter & R0<=TargetHigh
fprintf('Success!\n\n');
break;
end
end
Lim Miso
Lim Miso on 8 Dec 2015
this is my code. I tried to fix 4 points around the CenterPoints of each two linear lines. Then I tried to move the box and airplane by using SET command. But it was not working.
I tried as many things as possible, but failed. hope you can give me an idea.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!