Filling an area between max and minimum lines on a plot
You are now following this question
- You will see updates in your followed content feed.
- You may receive emails, depending on your communication preferences.
An Error Occurred
Unable to complete the action because of changes made to the page. Reload the page to see its updated state.
0 votes
Share a link to this question
Accepted Answer

19 Comments



Hi Jonas - thanks for chiming in. I'm not sure I fully understand, but I have gone back and checked and everything is a 401 x 1 vector.
As dpb pointed out it might be a bit confusing to reassign things to x & y (although I originally did it to make sure I understood what was going on) I have gone back to:
patch([increments' fliplr(increments')],[min_output fliplr(max_output)],'c')
Where:
each of the elements, increments', fliplr(increments'), min_output and fliplr(max_output) are all size 401 x 1.
If increments' is in fact 401 x 1 (single column) then fliplr (flip left right) does nothing for you. Use flipud (flip up down) in that case.
Again, if increments' is single column, then
[increments' flipud(increments')]
is double column, which strengthens my suspicion. Possibly, this could work for you:
patch([increments'; flipud(increments')],[min_output;flipud(max_output)],'c')
...or you could just keep the original code and just remove the transpose (').
Just make sure the input to patch (everything within the [ ]) are vectors and you should be fine
Yes, and your initial code was based on row vectors, not column which is why used fliplr. I tend to forget flip which is a (relatively) late arrival will do whichever is "the right thing" on a vector of either orientation instead of just operating on the specific orientation of the specific (original) versions.
More Answers (0)
Categories
Find more on Logical in Help Center and File Exchange
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)