x-y plot: how to shade the difference between two lines in multiple colors
Show older comments
kindly help me to fill the diffrence with two diffrent colur in a x y plot as shown in the below example figure?

I need to shade postive(red color) and negative diffrences(blue color) in diffrent colors. Kindly give your suggesttions

t= 0:.01:1
AA = cos(t)
BB= sin(t)
diff = AA-BB
plot(t,AA)
hold on
plot(t,BB)
patch([t fliplr(t)], [AA fliplr(BB)], 'r')
hold off
%%% any suggestions Please!!
Accepted Answer
More Answers (0)
Categories
Find more on 2-D and 3-D 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!