Thank you for your previous help. Here my last question regarding this topic. Thank you in advance 🙂 BR Mueller Philipp
Matlab sets automat. the x/y range of the diagram depending on the input data. I want to set it manually. Matlab should not set it.
axis ([ -500 500 0 222]); This command does not work.If i use this command all other diagrams are also involved and changed.I want for each diagram own limits for x and y (z).clear all %löscht alle Variablen
clear clc %löscht den Bildschirm
%Subplot Einstellungen
%fig = figure;
%fig.Units = 'centimeters';
%fig.Position(3:4) = [25 25];
%ax11 = axes('units', 'centimeters', 'position', [ 3, 21, 7, 7]);%Spalte 1 Reihe 1
%ax12 = axes('units', 'centimeters', 'position', [ 12, 21, 7, 7]);%Spalte 2 Reihe 1
%ax21 = axes('units', 'centimeters', 'position', [ 3, 12, 7, 7]);%Spalte 1 Reihe 2
%ax22 = axes('units', 'centimeters', 'position', [ 12, 12, 7, 7]);%Spalte 2 Reihe 2
%ax31 = axes('units', 'centimeters', 'position', [ 3, 3, 7, 7]);%Spalte 1 Reihe 3
%ax32 = axes('units', 'centimeters', 'position', [ 12, 3, 7, 7]);%Spalte 2 Reihe 3
fig = figure;fig.Units = 'centimeters';fig.Position(3:4) = [25 25];plotPositions = [ 3, 21, 7, 7; 12, 21, 7, 7; 3, 12, 7, 7; 12, 12, 7, 7; 3, 3, 7, 7; 12, 3, 7, 7]; for i = 1:length(plotPositions) plotHandle = subplot(3, 2, i); plotHandle.Units = 'centimeters'; plotHandle.Position = plotPositions(i,:); end %RAINFLOWDARSTELLUNG%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Input_Matrix = textread('Input1.txt')%liest die Daten fĂĽr die Rainflow Darstellung ein
[zeilen,spalten]=size(Input_Matrix) x = Input_Matrix(:,1) y = Input_Matrix(:,2) z = Input_Matrix(:,3)%Definiert mir den Range des Diagramms...
axis ([ -500 500 0 222]);%manuelle Festlegung der Grenzen, hier solltest du
%die jeweiligen höheren Werte der Funktionen eintragen....... Was ist
%grösser? Rainflow oder Cutoff?
%colorbar('location','Manual', 'position', [0.93 0.1 0.02 0.81]);
az = 0;el = 90;view(az, el);hold onview(0,90)% view from above !!!http://de.mathworks.com/help/matlab/ref/view.html
a = 12;%markersize kannst einstellen welche grösse du haben willst ...
%subplot(ax12)
subplot(3,2,2)%colorbar('location','Manual', 'position', [0.93 0.1 0.02 0.81]);scatter3(x, y, z, a, z, 'filled')hold onview(0, 90)%Hier macht er die richtige sortierung fĂĽr die korrekte darstellung.
%value = find(max(z)) ;
%hold on
%plot3(x(idx),y(idx),z(idx),'*r')
[m,ind]=max(z);%subplot(ax12)%subplot(3,2,2)
%colorbar('location','Manual', 'position', [0.93 0.1 0.02 0.81]);colorbarscatter3(x(ind), y(ind), z(ind),'*r');grid on;%Gitter eingeschalten...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%***************** Wie man eine Linie zeichnet - Allgemeine Erklärung ***************************
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%Hier die dicke braune "dummy Linie"
line([-350 -150],[20 20],[1000000000000 1000000000000],'Marker','.','LineStyle','-','LineWidth',9, 'Color',[.5 .4 .3])%***************** Ende **************************************************
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%********************Cutofflinien zeichnen********************************
%****************************************************************************************
%****************************************************************************************%****************************************************************************************%****************************************************************************************%****************************************************************************************%Initialisierungen fĂĽr die Berechnungen:***********************************
sigma_wk = 50; % Default Wert angenommen
tau_wk = 70; % Default Wert angenommenm_sigma = 0.07; % Steigung - Defaultwert angenommen
m_tau = 0.07; % Steigung - Defaultwert angenommenm_sigma_zwei = m_sigma*0.33; % Steigung etwas flacher -> 1/3 von m_sigma -> vom Punkt 2 nach 3
m_tau_zwei = m_tau*0.33; % Steigung etwas flacher -> 1/3 von m_sigma -> vom Punkt 2 nach 3multipikator=1.2;% FĂĽr das Zeichnen der Waagrechten Linien
%Normalspannungen:*********************************************************
%X-Koordianten der einzelnen Punkte
sigma_m_1=sigma_wk/(m_sigma-1);%Punkt1
sigma_m_2=sigma_wk/(1+m_sigma);%Punkt2
sigma_m_3=sigma_wk*((3+m_sigma)/(1+m_sigma_zwei)^2);%Punkt3
%Y-Werte der Punkte der einzelnen Punkte
sigma_a_1=sigma_wk/(1-m_sigma);%Punkt1sigma_a_2=sigma_wk/(1+m_sigma);%Punkt2 Vorzeichen plus gemacht!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
sigma_a_3=(sigma_wk/3)*((3+m_sigma)/(1+m_sigma)^2);%Punkt3%Schubspannungen***********************************************************
%X-Koordianten der einzelnen Punktetau_m_1=tau_wk/(m_tau-1);tau_m_2=tau_wk/(1+m_tau);tau_m_3=tau_wk*((3+m_tau)/(1+m_tau_zwei)^2);%
%Y-Werte der Punkte der einzelnen Punktetau_a_1=tau_wk/(1-m_tau);tau_a_2=tau_wk/(1+m_tau);tau_a_3=(tau_wk/3)*((3+m_tau)/(1+m_tau)^2);%Diagramm Beschriftungen***************************************************
%Farbauswahl http://www.avatar.se/molscript/doc/colour_names.html
title('\color[rgb]{0.698039 0.133333 0.133333}Normalspannungen - Schubspannungen');%Titel des Diagrammes.
ylabel('Beschriftung der y - Achse \color[rgb]{0 0.392157 0}\bf\sigma_{a}\tau_{a}');xlabel('Beschriftung der x - Achse \color[rgb]{0 0.392157 0}\bf\sigma_{m}\tau_{m}');grid on; %Gitter eingeblendet
%axis ([ -5 5 0 5]);%manuelle Festlegung der
%Grenzen!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
%axis tight ;%Mit "..." werden die Bereiche wieder so gesetzt, dass die Daten perfekt in den Plot passen.
%Griechische Buchstaben https://de.mathworks.com/help/matlab/creating_plots/greek-letters-and-special-characters-in-graph-text.html?searchHighlight=greek
%http://matlab.izmiran.ru/help/techdoc/ref/linespec.html
%**************************************************************************
%Jetzt wird gezeichnet Schubspannungen und Normalspannungen (in einem Diagram )****************************************************
% X-Werte, Y-Werte, Z-Werte %Hier werden 2 Punkte im 3D Raum miteinander verbunden.....
%Z-Koordinaten wurde defaultmässig auf 1e7 gesetzt damit die cutoff linien
%deckend sind.
%Die Benennung der Punkte habe ich von der ĂĽbernommen....
line([0 sigma_m_2],[sigma_wk sigma_a_2],[1e7 1e7],'Marker','.','LineStyle','-','LineWidth',1, 'Color',[1 0 0])% 0-2
line([sigma_m_2 sigma_m_3],[sigma_a_2 sigma_a_3],[1e7 1e7],'Marker','.','LineStyle','-','LineWidth',1, 'Color',[0 1 0])%2-3
line([0 sigma_m_1],[sigma_wk sigma_a_1],[1e7 1e7],'Marker','.','LineStyle','-','LineWidth',1, 'Color',[0 0 1])%0-1
%Waagrechte Linien: (mit dem Multiplikator habe ich defaultmässig
line([sigma_m_3 sigma_m_3*multipikator],[sigma_a_3 sigma_a_3],[1e7 1e7],'Marker','.','LineStyle','-','LineWidth',3, 'Color',[1 0 0])%Rechts
line([sigma_m_1 sigma_m_1*multipikator],[sigma_a_1 sigma_a_1],[1e7 1e7],'Marker','.','LineStyle','-','LineWidth',3, 'Color',[1 0 0])%Links
%Schubspannungen***********************************************************line([0 tau_m_2],[tau_wk tau_a_2],[1e7 1e7],'Marker','.','LineStyle','-','LineWidth',5, 'Color',[0 1 1])line([tau_m_2 tau_m_3],[tau_a_2 tau_a_3],[1e7 1e7],'Marker','.','LineStyle','-','LineWidth',5, 'Color',[0 0 1]) line([0 -tau_m_2],[tau_wk tau_a_2],[1e7 1e7],'Marker','.','LineStyle','-','LineWidth',5, 'Color',[1 0 1])line([-tau_m_2 -tau_m_3],[tau_a_2 tau_a_3],[1e7 1e7],'Marker','.','LineStyle','-','LineWidth',5, 'Color',[0 1 1])line([tau_m_3 tau_m_3*multipikator],[tau_a_3 tau_a_3],[1e7 1e7],'Marker','.','LineStyle','-','LineWidth',3, 'Color',[1 0 0])% %Waagrechte Linien: Rechts
line([-tau_m_3 -tau_m_3*multipikator],[tau_a_3 tau_a_3],[1e7 1e7],'Marker','.','LineStyle','-','LineWidth',3, 'Color',[1 0 0])% %Waagrechte Linien: Links
%****************************************************************************************%****************************************************************************************%****************************************************************************************hold off%WĂ–HLER
Input_Matrix_Woehler = textread('2.txt')x1 = Input_Matrix_Woehler(:,1)y1 = Input_Matrix_Woehler(:,2)%xlim(axes1,[1000 200000000]);
%axis ([ 1000 1e7 0 130]);
% Create semilogx
% Uncomment the following line to preserve the X-limits of the axes
[xb,yb] = stairs(x1,y1);%plot(xb,yb)
%CREATEFIGURE(X1, Y1)
% X1: vector of x data
% Y1: vector of y data
% Auto-generated by MATLAB on 26-Sep-2016 15:00:15
% Create figure
%figure1 = figure('Name','Woehler',...
% 'Color',[0.756862759590149 0.866666674613953 0.776470601558685]);
% Create axes
%axes1 = axes('Parent',figure1);
%hold(axes1,'on');
% Create semilogx% Uncomment the following line to preserve the X-limits of the axes% xlim(axes1,[1000 200000000]);
%box(axes1,'on');
% Set the remaining axes properties
%set(axes1,'Color',[0.894117653369904 0.941176474094391 0.901960790157318],...
% 'XMinorTick','on','XScale','log');
%axis ([ 1000 200000000 0 120]);%manuelle Festlegung der Grenzen, hier solltest du
%subplot(ax11)
subplot(3,2,1)%plot(yb,xb)
%axis(ax,'manual',1000 1e7 0 130)
plot(yb,xb)%plot(x1,y1)
%http://stackoverflow.com/questions/15814068/pcolor-in-scatter-plot-matlab
%https://plot.ly/alpha/workspace/
%[dummy ID]=sort(z);
%colors=colormap(jet(length(z)));
%figure
%for i=1:length(z)
%plot(x(i),y(i),'s','MarkerFaceColor',colors(ID(i),:));
%hold on%end
subplot(3,2,3)subplot(3,2,4)subplot(3,2,5)subplot(3,2,6)datacursormode on %damit ich die punkte im diagram anclicken kann und die jeweiligen werte angezeigt bekomme .....
%figure('units','centimeters','position',[3 3 5 5])
Best Answer