billiard_input.m

来自「一个有趣的桌面撞球模拟,可录制avi,输出坐标参数及图象」· M 代码 · 共 27 行

M
27
字号
% This is the User Input Section of the (Billiard Table) program

function [width,height,x0,y0,v0,th,mu,e,t_int,FILE]=billiard_input

width=input('Enter the Table Width: ');
height=input('Enter the Table Height: ');
x0=input('Enter the Initial X-coordinate of the Billiard Ball: ');

while x0<0 | x0>width
    disp(['Error! Try Again! Enter a number between 0 & ',num2str(width),': '])
    x0=input(' ');
end

y0=input('Enter the Initial Y-coordinate of the Billiard Ball: ');

while y0<0 | y0>height
    disp(['Error! Try Again! Enter a number between 0 & ',num2str(width),': '])
    y0=input(' ');
end

v0=input('Enter the Initial Velocity of the Billiard Ball: ');
th=input('Enter the Initial Angle of the Billiard Ball  (degrees): ');
mu=input('Enter the Billiard Table Coefficient of Friction: ');
e=input('Enter the Billiard Table Sides Coefficient of Restitution: ');
t_int=input('Enter the Time Frame Intervale: ');
FILE=input('Enter Data File Name (ex. data): ','s');

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?