finding lower and upper limit of a function

3 views (last 30 days)
soloby
soloby on 13 Jun 2015
Answered: Jan on 13 Jun 2015
x = -10:0.1:10;
f1 = trapmf(x,[-2 0 0 2]);
if i plot(x,f1), this will give me a triangular wave.
I need to seperate the f1 values into two sections, one left of the peak and one right of the peak.
What's the best way of doing this? an If statement?

Answers (1)

Jan
Jan on 13 Jun 2015
[maxValue, maxIndex] = max(f1);
First part: 1:maxIndex , second part: maxIndex+1:length(x)

Categories

Find more on Loops and Conditional Statements 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!