Clear Filters
Clear Filters

scattering a graph between specific points

1 view (last 30 days)
Hello everyone,
I'm looking to scatter two sets of data across a graph between specific points. I would like to scatter 9 points between x = 1.36 and x = 0.97 and I would like to scatter on the same graph 11 points of different size between x = 1.32 and x = 0.93. All the data points are at y = 0. How do I do this?
Thank you

Accepted Answer

KSSV
KSSV on 17 Aug 2020
Edited: KSSV on 17 Aug 2020
Two cases:
Case 1: If the points are equidistant
x1 = linspace(0.97,1.36,9) ;
x2 = linspace(0.93,1.32,11) ;
y1 = zeros(size(x1)) ;
y2 = zeros(size(x2)) ;
plot(x1,y1,'*r',x2,y2,'*b')
Case 2: If the points are random
x1 = linspace(0.97,1.36,100) ;
x2 = linspace(0.93,1.32,100) ;
x1 = x1(randperm(100,9)) ;
x2 = x2(randperm(100,11)) ;
y1 = zeros(size(x1)) ;
y2 = zeros(size(x2)) ;
plot(x1,y1,'*r',x2,y2,'*b')

More Answers (0)

Categories

Find more on Discrete Data 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!