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