how to visualize my code.

1 次查看(过去 30 天)
Lim Miso
Lim Miso 2015-12-8
编辑: Lim Miso 2015-12-9
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.

回答(1 个)

Chad Greene
Chad Greene 2015-12-8
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 个评论
Lim Miso
Lim Miso 2015-12-8
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 2015-12-8
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.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by