How to make the encircled curve by blue.

How to make the encircled curve by blue.
clear all
format long
set(0,'DefaultAxesFontSize',20);
figure;
load('H_LC(2).mat');
dim=2; %number of variables of my system which are x and y
MMM=max(x(1:dim:end-2,:));
plot(x(end,:),MMM,'r', 'LineWidth',2); % RED
hold on
load('H_LC(2).mat');
M=min(x(1:dim:end-2,:)); % end-2 excludes the parameter and the period from the continuation variable x
plot(x(end,:),M,'r', 'LineWidth',2);
hold on
xlabel('$aa$','FontSize',20,'interpreter','latex','FontWeight','normal','Color','k');
ylabel('$bb$','FontSize',20,'interpreter','latex','FontWeight','normal','Color','k');
hold on
axis([.1142595 .1142604 .5295 .5297]);

 채택된 답변

Aquatris
Aquatris 2024년 6월 7일
편집: Aquatris 2024년 6월 7일
You have one weird data and script to visualize but here is one way
clear all
warning off % you had references to F:/ folder in the mat file
format long
set(0,'DefaultAxesFontSize',20);
figure;
load('H_LC(2).mat');
dim=2; %number of variables of my system which are x and y
MMM=max(x(1:dim:end-2,:));
plot(x(end,:),MMM,'r', 'LineWidth',2); % RED
hold on
plot(x(end,[1 2]),MMM(1:2),'b', 'LineWidth',2); % BLUE LINE HERE
load('H_LC(2).mat');
M=min(x(1:dim:end-2,:)); % end-2 excludes the parameter and the period from the continuation variable x
plot(x(end,:),M,'r', 'LineWidth',2);
hold on
xlabel('$aa$','FontSize',20,'interpreter','latex','FontWeight','normal','Color','k');
ylabel('$bb$','FontSize',20,'interpreter','latex','FontWeight','normal','Color','k');
hold on
plot(x(end,[1 2]),M(1:2),'b', 'LineWidth',2); % BLUE LINE HERE
axis([.1142595 .1142604 .5295 .5297]);

댓글 수: 5

Atom
Atom 2024년 6월 7일
Thank you. Would you please explain a bit about the lines
plot(x(end,[1 2]),MMM(1:2),'b', 'LineWidth',2); % BLUE LINE HERE
and
plot(x(end,[1 2]),M(1:2),'b', 'LineWidth',2); % BLUE LINE HERE
Aquatris
Aquatris 2024년 6월 7일
Exactly what do you not understand?
I understood that in your plot you draw the red line using 3 points for downward line and 3 point for upward line, which has same x values but different M and MMM values. I found the points that would give you the desired blue lines and plot them.
x(end,[1 2]) -> this gives you 2 points: the last row, 1st and 2nd column of x
M(1:2) -> corresponding M value for x(end,[1 2])
MMM(1:2) -> corresponding MMM value for x(end,[1 2])
Atom
Atom 2024년 6월 7일
Thank you. Just one question. The red and blue curves are supposed to be smooth. What mistake did I make that caused a nonsmooth appearance at the point where the red and blue curves intersect?
Aquatris
Aquatris 2024년 6월 7일
I have no idea since I dont know what this data is and what you are trying to do. If you explain what the data in x variable is (which seems to be a triangle wave, but it might also be an undersampled sine wave), I might have an answer.
Aquatris
Aquatris 2024년 6월 7일
If you only meant visualy they are pixelated, then it is a tricky issue that can also be caused by your PC graphics card

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

질문:

2024년 6월 7일

댓글:

2024년 6월 7일

Community Treasure Hunt

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

Start Hunting!

Translated by