How to set multiple limits for multiple lines in a single graph with given data
조회 수: 5 (최근 30일)
이전 댓글 표시
I currently have a graph that has 2 sloped lines. I cannot simply set the boundaries of X because the data was given in matrix El. I want to have a line go from X = 9 to 13 and another line from X = 13 to 16. El is a matrix of 2x1601 (2 is for 2 lines) and I just want to keep the portion between those limits. Here is the code (may be a bit long)
I tried linspace so that I could even plot it, but I see now that it just squishes the values of El into the desired limits, giving me the wrong line.
I am trying to automatically create graphs (pourbaix diagrams) that can be pretty complex.
This is what I want:
This is what I'm getting:
Basically, the code is set up to calculate the slope of those 2 lines, where it will then calculate the intersection of them. This intersection is then set as a lower limit for the line that goes from 13 to 16 (the line with a higher slope). So I want the line with the lesser slope to be in the range of X = 9-13
%setting up sloped lines
s1a = El(1,:);
s2a = El(2,:);
ab1 = linspace(b,a,length(s1a));
ab2 = linspace(a,mx,length(s2a));
s1 = diff(s1a)/diff(ab1)
s2 = diff(s2a)/diff(ab1)
%finding intersection of the 2 lines so boundary can be found for vert line
[x1,y1] = polyxpoly(pH,s1a,pH,s2a);
if s1 > s2
plot(ab2,s1a);
plot(ab1,s2a);
else
plot(ab1,s1a);
plot(ab2,s2a);
end
댓글 수: 6
darova
2020년 4월 27일
Im completely lost. There is too much information for me. Can you simplify the question? Maybe another picture?
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Graphics Performance에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!