I know Max and Min values and indexes from original vector. I want to plot(x aixis is index number) these values to get trends.

1 view (last 30 days)
hallo
I want to make a plot which connect local max and min values. I want to simplify my orignal plot with this method. I got max and min indexes and values but I dont know how to plot these values together. help me
Thanks.
  1 Comment
Vaidyanathan Thiagarajan
Vaidyanathan Thiagarajan on 2 Nov 2017
Edited: Vaidyanathan Thiagarajan on 2 Nov 2017
Hi,
Can you please post your code and the plot that you would expect the code to create? It is not clear what your objectives are? Are you using the optimization toolbox? Please provide us with more details.
Best Regards,
Vaidyanathan

Sign in to comment.

Answers (1)

Jos (10584)
Jos (10584) on 2 Nov 2017
You question is somewhat unclear, but I will make an educated guess. Assuming the data looks like this:
IndexNum = [ 1 2 5 9] ;
MinValues = [ 1 3 7 11] ;
MaxValues = [11 15 22 34] ;
You can make a plot connecting all MinValues and connecting all Maxvalues:
plot(IndexNum, MinValues ,'bo-',IndexNum, MaxValues,'rs-') ;
or you can make a plot connecting a MinValue to a MaxValue, for each index:
plot([IndexNum ; IndexNum],[MinValues ; MaxValues],'b^:')

Categories

Find more on Creating and Concatenating Matrices 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!