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

2 views (last 30 days)
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;

Answers (1)

Image Analyst
Image Analyst on 30 Nov 2017
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.

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!