WICHTIG: Der Betrieb von goMatlab.de wird privat finanziert fortgesetzt. - Mehr Infos...

Mein MATLAB Forum - goMatlab.de

Mein MATLAB Forum

 
Gast > Registrieren       Autologin?   

Partner:




Forum
      Option
[Erweitert]
  • Diese Seite per Mail weiterempfehlen
     


Gehe zu:  
Neues Thema eröffnen Neue Antwort erstellen

Hilbe bei Plot mit doppelter x-Achse benötigt

 

Patrick1990
Forum-Fortgeschrittener

Forum-Fortgeschrittener


Beiträge: 51
Anmeldedatum: 25.02.13
Wohnort: Thüringen
Version: 2015b
     Beitrag Verfasst am: 28.12.2017, 12:01     Titel: Hilbe bei Plot mit doppelter x-Achse benötigt
  Antworten mit Zitat      
Hallo liebes Forum,

ich würde gern ein Diagramm (siehe Anhang) nachbilden.

Bisher bin ich an diesem Punkt angekommen:

Code:
clear all;
close all;

data_below = [
[0.1, 1];
[0.2, 2.4];
[0.3, 3.05];
[0.4, 3.5];
[0.5, 3.9];
[1.0, 4.8];
[2.0, 5.4];
[4.0, 6.0]
];

data_above = [
[0.1, 1.8];
[0.2, 3.2];
[0.3, 4.0];
[0.4, 4.5];
[0.5, 4.95];
[1.0, 5.95];
[2.0, 6.7];
[4.0, 7.2]
];

xx = 0.1:.005:4;
yy_below = spline(data_below(:,1),data_below(:,2),xx);
yy_above = spline(data_above(:,1),data_above(:,2),xx);

y1 = interp1(data_below(:,1),data_below(:,2),xx,'pchip');
y2 = interp1(data_above(:,1),data_above(:,2),xx,'pchip');


hAX=axes('xlim', [0.1 4], 'ylim', [0 8], 'XScale', 'log', 'XTick', [0.1 0.15 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 1.5 2.0 3.0 4.0], 'XTickLabel', {'0.1', '', '0.2', '', '', '0.5', '', '', '', '', '1.0', '', '2.0', '', '4.0'});                 % first axes, save handle
pos = get(hAX,'position');   % get the position vector
pos1=pos(2);              % save the original bottom position
pos(2)=pos(2)+pos1; pos(4)=pos(4)-pos1;  % raise bottom/reduce height->same overall upper position
set(hAX,'position',pos)   % and resize first axes
pos(2)=pos1; pos(4)=0.01; % reset bottom to original and small height
hAX(2)=axes('position',pos,'color','none','xlim', [0.002 60],'XScale', 'log', 'XTick', [0.002 0.005 0.01 0.1 0.4 1.0 2 4 6 10 20 30 40 50 60], 'XTickLabel', {'0.002', '', '0.01', '0.1', '0.4', '1.0', '2', '4', '6', '10', '20', '', '40', '', '60'});  % and create the second
ylabel(hAX(1),'Axes 1')
xlabel(hAX(1),'Axes 1')
xlabel(hAX(2),'Axes 2')
set(hAX(2),'xcolor','r','ycolor','r')

fill([xx;xx],[y1;y2], 'red','Parent',hAX(1)); % ylim nun nicht mehr zwischen 0 und 8

line(data_below(:,1), data_below(:,2), 'Parent',hAX(1), 'marker', 'x')
line(data_above(:,1), data_above(:,2), 'Parent',hAX(1), 'marker', 'x')

line(xx, y1,'Parent',hAX(1), 'color', 'red')
line(xx, y2,'Parent',hAX(1), 'color', 'red')

 


Wenn ich den ill-Befehl auskommentiere, ist die y-Achse wieder auf den Bereich zwischen 0 und 8 begrenzt. Ansonsten verstellt sich der Bereich von 1 auf 8. Woran liegt das?

Weiterhin fehlt das Grid und ich würde (wenn möglich gern auch noch die anderen Kurven mit deren Achsen und Achsenbeschriftungen einfügen).

Könnt ihr mir helfen?

Diagramm.jpg
 Beschreibung:

Download
 Dateiname:  Diagramm.jpg
 Dateigröße:  217.67 KB
 Heruntergeladen:  312 mal
Private Nachricht senden Benutzer-Profile anzeigen


Neues Thema eröffnen Neue Antwort erstellen



Einstellungen und Berechtigungen
Beiträge der letzten Zeit anzeigen:

Du kannst Beiträge in dieses Forum schreiben.
Du kannst auf Beiträge in diesem Forum antworten.
Du kannst deine Beiträge in diesem Forum nicht bearbeiten.
Du kannst deine Beiträge in diesem Forum nicht löschen.
Du kannst an Umfragen in diesem Forum nicht mitmachen.
Du kannst Dateien in diesem Forum posten
Du kannst Dateien in diesem Forum herunterladen
.





 Impressum  | Nutzungsbedingungen  | Datenschutz | FAQ | goMatlab RSS Button RSS

Hosted by:


Copyright © 2007 - 2024 goMatlab.de | Dies ist keine offizielle Website der Firma The Mathworks

MATLAB, Simulink, Stateflow, Handle Graphics, Real-Time Workshop, SimBiology, SimHydraulics, SimEvents, and xPC TargetBox are registered trademarks and The MathWorks, the L-shaped membrane logo, and Embedded MATLAB are trademarks of The MathWorks, Inc.