怎么把坐标方程的点按时间顺序连接起来。

clc;clear;
for t=0:1:100
x0=0; y0=0;
sub_v=10+(20-10)*rand;
sub_thita=pi/2*rand;
sub_x=x0+sub_v*t*cos(sub_thita)
sub_y=y0+sub_v*t*sin(sub_thita)
把这些随机点按先后顺序连接起来,输出图像

 Réponse acceptée

libew
libew le 22 Nov 2022

0 votes

帮你修改了一下程序供参考
%% 清空环境变量
close all; clear; clc;
%% 主程序
t=0:1:100
x0=0; y0=0;
sub_v=10+(20-10)*rand(1,101);
sub_thita=pi/2.*rand(1,101);
sub_x=x0+sub_v.*t.*cos(sub_thita);
sub_y=y0+sub_v.*t.*sin(sub_thita);
figure;
plot(sub_x,sub_y,'ko--')
运行结果如图

Plus de réponses (0)

Catégories

En savoir plus sur 初等数学 dans Centre d'aide et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!