multiple y axes, one x axis
Ältere Kommentare anzeigen
Hello, I want to know how to do three y axis one next to one on left side with space.. My function and i want it that is everything on left side on y axis.
clc
clear all
close all
x=[5.93 5.65 4.91 4.28 3.77 3.25];
y1=[10.72 10.15 8.76 7.61 6.68 5.76];
y2=[62.5 50 41.25 31.25 25 17.5];
y3=[4.661 4.413 3.809 3.309 2.904 2.504];
figure;
ax1 = gca;
get(ax1,'Position')
pos_ax1 = get(ax1,'Position');
set(ax1,'XColor','k',...
'YColor','b',...
'YLim',[0,12],...
'YTick',[0:1:12]);
ylabel('U_1_K [V]')
xlabel('I_1_K [A]')
line(x, y1, 'Color', 'b', 'LineStyle', '-', 'Marker', '.', 'Parent', ax1)
grid on
ax2 = axes('Position',get(ax1,'Position'),...
'XAxisLocation','bottom',...
'YAxisLocation','left',...
'Color','none',...
'XColor','k',...
'YColor','r',...
'YLim',[0,70],...
'YTick',[0:5:70],...
'XTick',[],'XTickLabel',[]);
ylabel('P_1_K [W]')
pos_ax2=pos_ax1-1;
line(x, y2, 'Color', 'r', 'LineStyle', '-', 'Marker', '.', 'Parent', ax2)
ax3 = axes('Position',get(ax1,'Position'),...
'XAxisLocation','bottom',...
'YAxisLocation','right',...
'Color','none',...
'XColor','k',...
'YColor','magenta',...
'YLim',[0,5],...
'YTick',[0:0.5:5],...
'XTick',[],'XTickLabel',[]);
ylabel('u_K [%]')
line(x, y3, 'Color', 'g', 'LineStyle', '-', 'Marker', '.', 'Parent', ax3)
title('Prikaz merilnih rezultatov')
%
%figure 2
I_n = 5.435;
U_1_k=interp1(x,y1,I_n)
P_1_k=interp1(x,y2,I_n)
Thanks :)
Akzeptierte Antwort
Weitere Antworten (1)
Image Analyst
am 19 Jan. 2014
0 Stimmen
Adapt this code supplied by the Laura at Mathworks: http://www.mathworks.com/matlabcentral/fileexchange/39595-multiplotyyy
4 Kommentare
Azzi Abdelmalek
am 19 Jan. 2014
androSLO commented
Where to adapt this code into it cause it doesn't work..
Azzi Abdelmalek
am 19 Jan. 2014
androSLO, I've deleted your answer, and posted it above, because it's supposed to be a comment, not an answer. To add a comment just click on: comment on this answer
androSLO
am 19 Jan. 2014
Image Analyst
am 19 Jan. 2014
Put it there somewhere between the first line and the last line. I think you're a smart enough engineer to figure it out. Sorry but I don't know the details of her code, and don't have the time to do it all for you.
Kategorien
Mehr zu MATLAB finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


