How can I connect the upper endpoint of the red curve to the red do... (2024)

46 Ansichten (letzte 30 Tage)

Ältere Kommentare anzeigen

Atom am 8 Jun. 2024 um 7:24

  • Verknüpfen

    Direkter Link zu dieser Frage

    https://de.mathworks.com/matlabcentral/answers/2126636-how-can-i-connect-the-upper-endpoint-of-the-red-curve-to-the-red-dot-while-keeping-the-curvature-nea

  • Verknüpfen

    Direkter Link zu dieser Frage

    https://de.mathworks.com/matlabcentral/answers/2126636-how-can-i-connect-the-upper-endpoint-of-the-red-curve-to-the-red-dot-while-keeping-the-curvature-nea

Bearbeitet: Image Analyst am 8 Jun. 2024 um 19:18

  • BT_Hom(2).mat

In MATLAB Online öffnen

How can I connect the upper endpoint of the red curve to the red dot while keeping the curvature nearly the same?

clear all

format long

warning off

figure

set(0,'DefaultAxesFontSize',20);

load('BT_Hom(2).mat')

[~,idx] = max(x(326,:));

plot(x(326,1:idx-20),x(325,1:idx-20),'r', 'LineWidth',2);

hold on

axis([0.14 .18 .15 .18]);

scatter(0.174701,0.177614, 'o', 'MarkerFaceColor', 'r');

xlabel('$a\rightarrow$','FontSize',20,'interpreter','latex','FontWeight','normal','Color','k')

ylabel('$b\rightarrow$','FontSize',20,'interpreter','latex','FontWeight','normal','Color','k')

How can I connect the upper endpoint of the red curve to the red do... (2)

0 Kommentare

-2 ältere Kommentare anzeigen-2 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

Melden Sie sich an, um diese Frage zu beantworten.

Antworten (2)

Image Analyst am 8 Jun. 2024 um 14:03

  • Verknüpfen

    Direkter Link zu dieser Antwort

    https://de.mathworks.com/matlabcentral/answers/2126636-how-can-i-connect-the-upper-endpoint-of-the-red-curve-to-the-red-dot-while-keeping-the-curvature-nea#answer_1469056

  • Verknüpfen

    Direkter Link zu dieser Antwort

    https://de.mathworks.com/matlabcentral/answers/2126636-how-can-i-connect-the-upper-endpoint-of-the-red-curve-to-the-red-dot-while-keeping-the-curvature-nea#answer_1469056

  • BT_Hom(2).mat

Try using plot after you use scatter to draw a line from the last point on the curve to the marker you placed with scatter():

figure

set(0,'DefaultAxesFontSize',20);

load('BT_Hom(2).mat')

Warning: Could not find appropriate function on path loading function handle F:\1. Research\2. Mathematical Biology\MatCont7p4\MatCont7p4\hom*oclinic\hom*oclinic.m>curve_func

Warning: Could not find appropriate function on path loading function handle F:\1. Research\2. Mathematical Biology\MatCont7p4\MatCont7p4\hom*oclinic\hom*oclinic.m>defaultprocessor

Warning: Could not find appropriate function on path loading function handle F:\1. Research\2. Mathematical Biology\MatCont7p4\MatCont7p4\hom*oclinic\hom*oclinic.m>options

Warning: Could not find appropriate function on path loading function handle F:\1. Research\2. Mathematical Biology\MatCont7p4\MatCont7p4\hom*oclinic\hom*oclinic.m>jacobian

Warning: Could not find appropriate function on path loading function handle F:\1. Research\2. Mathematical Biology\MatCont7p4\MatCont7p4\hom*oclinic\hom*oclinic.m>hessians

Warning: Could not find appropriate function on path loading function handle F:\1. Research\2. Mathematical Biology\MatCont7p4\MatCont7p4\hom*oclinic\hom*oclinic.m>testf

Warning: Could not find appropriate function on path loading function handle F:\1. Research\2. Mathematical Biology\MatCont7p4\MatCont7p4\hom*oclinic\hom*oclinic.m>userf

Warning: Could not find appropriate function on path loading function handle F:\1. Research\2. Mathematical Biology\MatCont7p4\MatCont7p4\hom*oclinic\hom*oclinic.m>process

Warning: Could not find appropriate function on path loading function handle F:\1. Research\2. Mathematical Biology\MatCont7p4\MatCont7p4\hom*oclinic\hom*oclinic.m>singmat

Warning: Could not find appropriate function on path loading function handle F:\1. Research\2. Mathematical Biology\MatCont7p4\MatCont7p4\hom*oclinic\hom*oclinic.m>locate

Warning: Could not find appropriate function on path loading function handle F:\1. Research\2. Mathematical Biology\MatCont7p4\MatCont7p4\hom*oclinic\hom*oclinic.m>init

Warning: Could not find appropriate function on path loading function handle F:\1. Research\2. Mathematical Biology\MatCont7p4\MatCont7p4\hom*oclinic\hom*oclinic.m>done

Warning: Could not find appropriate function on path loading function handle F:\1. Research\2. Mathematical Biology\MatCont7p4\MatCont7p4\hom*oclinic\hom*oclinic.m>adapt

Warning: Could not find appropriate function on path loading function handle F:\1. Research\2. Mathematical Biology\MatCont7p4\MatCont7p4\Systems\sudeshna_3.m>fun_eval

Warning: Could not find appropriate function on path loading function handle F:\1. Research\2. Mathematical Biology\MatCont7p4\MatCont7p4\Systems\sudeshna_3.m>jacobian

Warning: Could not find appropriate function on path loading function handle F:\1. Research\2. Mathematical Biology\MatCont7p4\MatCont7p4\Systems\sudeshna_3.m>jacobianp

Warning: Could not find appropriate function on path loading function handle F:\1. Research\2. Mathematical Biology\MatCont7p4\MatCont7p4\Systems\sudeshna_3.m>hessians

Warning: Could not find appropriate function on path loading function handle F:\1. Research\2. Mathematical Biology\MatCont7p4\MatCont7p4\Systems\sudeshna_3.m>hessiansp

Warning: Could not find appropriate function on path loading function handle F:\1. Research\2. Mathematical Biology\MatCont7p4\MatCont7p4\Systems\sudeshna_3.m>der3

Warning: Could not find appropriate function on path loading function handle F:\1. Research\2. Mathematical Biology\MatCont7p4\MatCont7p4\GUI\ComputationConfigurations\ContCurve.m>@(dat)loaderfunction(dat)

[~,idx] = max(x(326,:));

plot(x(326,1:idx-20), x(325,1:idx-20), 'r', 'LineWidth',2);

hold on

axis([0.14 .18 .15 .18]);

scatter(0.174701,0.177614, 'o', 'MarkerFaceColor', 'r');

xTip = [x(326,1:idx-20), 0.174701];

yTip = [x(325,1:idx-20), 0.177614];

plot(xTip, yTip, 'r-', 'LineWidth', 2);

grid on;

xlabel('$a\rightarrow$','FontSize',20,'interpreter','latex','FontWeight','normal','Color','k')

ylabel('$b\rightarrow$','FontSize',20,'interpreter','latex','FontWeight','normal','Color','k')

How can I connect the upper endpoint of the red curve to the red do... (4)

There will be a slight change in curvature. It it's really objectionable, you can use the scatter point and the last two points of the curve and fit a cubic to it and interpolate a bunch of points in between. Not sure it would look much different though than the straight line.

2 Kommentare

Keine anzeigenKeine ausblenden

Atom am 8 Jun. 2024 um 14:34

Direkter Link zu diesem Kommentar

https://de.mathworks.com/matlabcentral/answers/2126636-how-can-i-connect-the-upper-endpoint-of-the-red-curve-to-the-red-dot-while-keeping-the-curvature-nea#comment_3182216

  • Verknüpfen

    Direkter Link zu diesem Kommentar

    https://de.mathworks.com/matlabcentral/answers/2126636-how-can-i-connect-the-upper-endpoint-of-the-red-curve-to-the-red-dot-while-keeping-the-curvature-nea#comment_3182216

Bearbeitet: Atom am 8 Jun. 2024 um 14:37

Thank you. I tried using the straight line approach, but the curvature isn't very smooth. If the gap of curve and point is increased a bit more, it will look bad. Could you please help me with the code of the other method you mentioned?

Image Analyst am 8 Jun. 2024 um 19:16

Direkter Link zu diesem Kommentar

https://de.mathworks.com/matlabcentral/answers/2126636-how-can-i-connect-the-upper-endpoint-of-the-red-curve-to-the-red-dot-while-keeping-the-curvature-nea#comment_3182281

  • Verknüpfen

    Direkter Link zu diesem Kommentar

    https://de.mathworks.com/matlabcentral/answers/2126636-how-can-i-connect-the-upper-endpoint-of-the-red-curve-to-the-red-dot-while-keeping-the-curvature-nea#comment_3182281

Bearbeitet: Image Analyst am 8 Jun. 2024 um 19:18

As you can see, Star used some more sophisticated methods and the plot looks virtually the same. Are they still not good enough? Is so, why not? What is the purpose of the plot? Who is the consumer/viewer of these plots and will they be annoyed if it's not smoother?

But realize that as the final point gets much further away, the connecting curve will have to look more and more like a line. I mean if the point was out at 0.4 or 0.5, what would you expect the connecting curve to look like? It can't be very curvy!

Melden Sie sich an, um zu kommentieren.

Star Strider am 8 Jun. 2024 um 18:36

  • Verknüpfen

    Direkter Link zu dieser Antwort

    https://de.mathworks.com/matlabcentral/answers/2126636-how-can-i-connect-the-upper-endpoint-of-the-red-curve-to-the-red-dot-while-keeping-the-curvature-nea#answer_1469101

  • Verknüpfen

    Direkter Link zu dieser Antwort

    https://de.mathworks.com/matlabcentral/answers/2126636-how-can-i-connect-the-upper-endpoint-of-the-red-curve-to-the-red-dot-while-keeping-the-curvature-nea#answer_1469101

In MATLAB Online öffnen

  • BT_Hom(2).mat

Here are options using pchip, makima and spline

clear all

format long

warning off

figure

set(0,'DefaultAxesFontSize',20);

load('BT_Hom(2).mat')

[~,idx] = max(x(326,:));

plot(x(326,1:idx-20),x(325,1:idx-20),'r', 'LineWidth',2);

hold on

axis([0.14 .18 .15 .18]);

scatter(0.174701,0.177614, 'o', 'MarkerFaceColor', 'r');

% line_end = [x(326,idx-20),x(325,idx-20)];

line_end = [x(326,idx-21:idx-20);x(325,idx-21:idx-20)];

scatter_point = [0.174701,0.17761];

connecting_line(1,:) = linspace(line_end(1), scatter_point(1), 150);

connecting_line(2,:) = pchip([line_end(1,:) scatter_point(1)], [line_end(2,:) scatter_point(2)], connecting_line(1,:));

plot(connecting_line(1,:), connecting_line(2,:),'r', 'LineWidth',2);

title('Using ‘pchip’')

xlabel('$a\rightarrow$','FontSize',20,'interpreter','latex','FontWeight','normal','Color','k')

ylabel('$b\rightarrow$','FontSize',20,'interpreter','latex','FontWeight','normal','Color','k')

How can I connect the upper endpoint of the red curve to the red do... (8)

figure

set(0,'DefaultAxesFontSize',20);

load('BT_Hom(2).mat')

[~,idx] = max(x(326,:));

plot(x(326,1:idx-20),x(325,1:idx-20),'r', 'LineWidth',2);

hold on

axis([0.14 .18 .15 .18]);

scatter(0.174701,0.177614, 'o', 'MarkerFaceColor', 'r');

% line_end = [x(326,idx-20),x(325,idx-20)];

line_end = [x(326,idx-21:idx-20);x(325,idx-21:idx-20)];

scatter_point = [0.174701,0.17761];

connecting_line(1,:) = linspace(line_end(1), scatter_point(1), 150);

connecting_line(2,:) = makima([line_end(1,:) scatter_point(1)], [line_end(2,:) scatter_point(2)], connecting_line(1,:));

plot(connecting_line(1,:), connecting_line(2,:),'r', 'LineWidth',2);

title('Using ‘makima’')

xlabel('$a\rightarrow$','FontSize',20,'interpreter','latex','FontWeight','normal','Color','k')

ylabel('$b\rightarrow$','FontSize',20,'interpreter','latex','FontWeight','normal','Color','k')

How can I connect the upper endpoint of the red curve to the red do... (9)

figure

set(0,'DefaultAxesFontSize',20);

load('BT_Hom(2).mat')

[~,idx] = max(x(326,:));

plot(x(326,1:idx-20),x(325,1:idx-20),'r', 'LineWidth',2);

hold on

axis([0.14 .18 .15 .18]);

scatter(0.174701,0.177614, 'o', 'MarkerFaceColor', 'r');

% line_end = [x(326,idx-20),x(325,idx-20)];

line_end = [x(326,idx-21:idx-20);x(325,idx-21:idx-20)];

scatter_point = [0.174701,0.17761];

connecting_line(1,:) = linspace(line_end(1), scatter_point(1), 150);

connecting_line(2,:) = spline([line_end(1,:) scatter_point(1)], [line_end(2,:) scatter_point(2)], connecting_line(1,:));

plot(connecting_line(1,:), connecting_line(2,:),'r', 'LineWidth',2);

title('Using ‘spline’')

xlabel('$a\rightarrow$','FontSize',20,'interpreter','latex','FontWeight','normal','Color','k')

ylabel('$b\rightarrow$','FontSize',20,'interpreter','latex','FontWeight','normal','Color','k')

How can I connect the upper endpoint of the red curve to the red do... (10)

This uses the last two points of the red line so that the interpolation functions can use that slope information as well. That is straightforward to expand if necessary. The original (and now commented-out) vales for ‘line_end’ used only the last point.

Zoom in on these to see which works best for you.

.

0 Kommentare

-2 ältere Kommentare anzeigen-2 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

Melden Sie sich an, um diese Frage zu beantworten.

Siehe auch

Kategorien

MATLABGraphics2-D and 3-D PlotsSurfaces, Volumes, and PolygonsSurface and Mesh Plots

Mehr zu Surface and Mesh Plots finden Sie in Help Center und File Exchange

Tags

  • plot
  • fiigure

Community Treasure Hunt

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

Start Hunting!

Es ist ein Fehler aufgetreten

Da Änderungen an der Seite vorgenommen wurden, kann diese Aktion nicht abgeschlossen werden. Laden Sie die Seite neu, um sie im aktualisierten Zustand anzuzeigen.


Translated by How can I connect the upper endpoint of the red curve to the red do... (11)

How can I connect the upper endpoint of the red curve to the red do... (12)

Website auswählen

Wählen Sie eine Website aus, um übersetzte Inhalte (sofern verfügbar) sowie lokale Veranstaltungen und Angebote anzuzeigen. Auf der Grundlage Ihres Standorts empfehlen wir Ihnen die folgende Auswahl: .

Sie können auch eine Website aus der folgenden Liste auswählen:

Amerika

  • América Latina (Español)
  • Canada (English)
  • United States (English)

Europa

  • 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
    • Deutsch
    • English
    • Français
  • United Kingdom(English)

Asien-Pazifik

Kontakt zu Ihrer lokalen Niederlassung

How can I connect the upper endpoint of the red curve to the red do... (2024)

References

Top Articles
Latest Posts
Article information

Author: Rev. Porsche Oberbrunner

Last Updated:

Views: 5862

Rating: 4.2 / 5 (53 voted)

Reviews: 84% of readers found this page helpful

Author information

Name: Rev. Porsche Oberbrunner

Birthday: 1994-06-25

Address: Suite 153 582 Lubowitz Walks, Port Alfredoborough, IN 72879-2838

Phone: +128413562823324

Job: IT Strategist

Hobby: Video gaming, Basketball, Web surfing, Book restoration, Jogging, Shooting, Fishing

Introduction: My name is Rev. Porsche Oberbrunner, I am a zany, graceful, talented, witty, determined, shiny, enchanting person who loves writing and wants to share my knowledge and understanding with you.