MATLAB Answers

How to find out the set of Y values > 0 and corresponding X values?

1 view (last 30 days)
I have a set of X values and corresponding Y values (n = 50). The X values are in the range [0:0.2:10]. The Y value corresponding to each X value has either +ve and -ve values. I would like to group all Y values which are +ve and also find out the corresponding X values.
I am unable to solve this issue. I tried using y(x(i))>0 but I got an error that the x(i) should be an integer.
Can anyone please help? Thank you.


Sign in to comment.

Accepted Answer

Cris LaPierre
Cris LaPierre on 19 Mar 2020
I recommend first learning about indexing in chapter 5 of MATLAB Onramp, then moving to logical indexing in chapter 12 (task 4 in particular)

More Answers (0)

Sign in to answer this question.

Translated by