필터 지우기
필터 지우기

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
darova 2020년 4월 27일
Im completely lost. There is too much information for me. Can you simplify the question? Maybe another picture?
Austin Hernandez
Austin Hernandez 2020년 4월 27일
The program I'm writing will automatically construct 2 graphs. Heres' the first:
The second is the "polished" version of the first graph, which is automatically found after determining where the line stops. I want a rough version of this:
but instead I get this:
The first graph is made from user inputs, and the second is an attempt at getting the proper graphs. I just simply want to take the data from the for loop, and plot it so that it looks like the 2nd picture. But I don't know how to automatically set the limits of the lines from the calculated data.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Title에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by