how to form the code with fixed number of values on x axis and variable number of values on y axis.

3 次查看(过去 30 天)
x=1, y= 2,3;
x=1, y= 2,3,4;
x=1, y= 2,3,4,5;
x=1, y= 2,3,4,5,6;
x=1, y= 2,3,4,5,6,7;
x=1, y= 2,3,4,5,6,7,8;
x=1, y=2,3,4,5,6,7,8,9;

回答(1 个)

Image Analyst
Image Analyst 2017-11-30
How about
x=1, y= [2,3];
x=1, y= [2,3,4];
x=1, y= [2,3,4,5];
x=1, y= [2,3,4,5,6];
x=1, y= [2,3,4,5,6,7];
x=1, y= [2,3,4,5,6,7,8];
x=1, y= [2,3,4,5,6,7,8,9];
or
for k = 1 : 9
x=1
y = 2:k
end
or
x = 1;
y = 2 : randi(9, 1, 1)
Or any number of other ways depending on what your intent is.

类别

Help CenterFile Exchange 中查找有关 2-D and 3-D Plots 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by