How to make a function generate random outputs using variables with given values?
显示 更早的评论
I have a 3D plot that uses the following equations for x,y,z:
t = linspace(0,2.*pi,1000);
x = 4.*cos(t).*sin(2.*t).*cos(10*t);
y = 7.*sin(t).*cos(3.*t);
z = t;
and the following codes to plot them:
figh = figure;
for k=1:length(t)
clf
t_k = t(k);
x_k = x(k);
y_k = y(k);
z_k = z(k);
plot3(x_k, y_k, z_k, 'gd', 'LineWidth', 2.5, 'MarkerSize', 12)
hold on
plot3(0.99*x_k, 0.99*y_k, 0.99*z_k, 'ro', 'LineWidth', 2.5, 'MarkerSize', 10)
hold on
plot3(0.98*x_k, 0.98*y_k, 0.98*z_k, 'bs', 'LineWidth', 2.5, 'MarkerSize', 10)
hold on
plot3(x, y, z, 'k-', 'LineWidth', 2);
end
My question is is there any way of producing a designated number of randomly generated outputs using this code? But for example for each output, things such as plot colour, marker appearance, size and width change?
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Get Started with MATLAB 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



