当前位置:网站首页>Matlab 3D diagram (unconventional)

Matlab 3D diagram (unconventional)

2022-06-21 07:32:00 jeff one

MATLAB Three dimensional diagram ( unconventional )

clear;clc;
x = -20:10:20;
y = 0:100;
%  Randomly generated  5  Group data , That is, on the target graph  5  Curve data 
z = zeros(5, 101);
z(1, 1:10:end) = linspace(1, 10, 11);
z(2, 1:10:end) = linspace(1, 20, 11);
z(3, 1:10:end) = linspace(1, 5, 11);
z(4, 5:10:end) = linspace(1, 10, 10);
z(5, 80:2:end) = linspace(1, 5, 11);
for i = 1:5
    % x  Direction each curve is a value , repeat  y  So many times  
    xx = x(i)*ones(1, 101)
    % z  The value of the direction , Take one at a time 
    zz = z(i, :);
    % plot3  stay  xyz  Draw curves in space , Guarantee  x y z  The length is consistent 
    plot3(xx, y, zz);
    hold on
end
hold off
legend('line1', 'line2', 'line3', 'line4', 'line5');

 Please add a picture description

原网站

版权声明
本文为[jeff one]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/172/202206210725304459.html