how to plot graph for specific points
4 views (last 30 days)
Show older comments
Balaji Ramdas
on 9 May 2022
Commented: Riccardo Scorretti
on 9 May 2022
i have plot graph for the specific points from a row
example: x= ( 1 2 3 4 5 7 8 9 ), y= ( a b c d e f g h i j )
i need to plot graph x v/s y between the points 3 - 8 only
0 Comments
Accepted Answer
Riccardo Scorretti
on 9 May 2022
Assuming that variables a, b, ... j make sense, you can do more or less like this:
x = [1 2 3 4 5 7 8 9];
y = [a b c d e f g h i j];
plot(x(3:8), y(3:8), 'o-'); % use 'o-', or whatever you like as drawing style
2 Comments
Riccardo Scorretti
on 9 May 2022
You must first convert z to an array of double (not it is a cell-array). Then you can use the function find:
z = cellfun(@(x) double(x), z); % this converts z to double
ind = find(20 <= z & z <= 500); % z(ind) are the values you are looking for
More Answers (0)
See Also
Categories
Find more on Line Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!