Labelling a Double Axis Graph

2 ビュー (過去 30 日間)
Matlab2010
Matlab2010 2013 年 3 月 28 日
However, an error occurs on adding axis labels;
x1 = [0:.1:40];
y1 = 4.*cos(x1)./(x1+2);
x2 = [0:.1:40];
y2 = 4.*sin(x1)./(x1+2);
x3 = [1:.2:20];
y3 = x3.^2./x3.^3;
figure;
hl1 = line(x1,y1,'Color','r');
ax1 = gca;
set(ax1,'XColor','r','YColor','r');
hold all;
hl2 = line(x2,y2,'Color','g');
ax2 = axes('Position',get(ax1,'Position'),...
'XAxisLocation','top',...
'YAxisLocation','right',...
'Color','none',...
'XColor','k','YColor','k');
hl3 = line(x3,y3,'Color','k','Parent',ax2);
%the above works fine.
title('My title')
%Now when we try and add labels, we get an error, "Value must be a handle"
set(ax1, 'Xlabel', 'G');
set(ax1, 'Ylabel', 'V');
set(ax2, 'Xlabel', 'D');
set(ax2, 'Ylabel', 'L');
any sensible comments gratefully recieved! thanks!

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 3 月 28 日
Try
xlabel(ax1, 'G');

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by