Маркировка разных осей двумя фигурами в одном окне Matlab

Я пытаюсь обозначить ось этих фигур по-разному, я пытаюсь обозначить только одну ось x как Time(s), а первую ось y - как f(t), а вторую - как g( т). Несмотря на реализацию определенного шрифта и размера, моя книга не показывает, как это сделать, и Интернет не очень помог.

Я знаю, что должен реализовать это, но я не знаю, где:

% swEPSfigure.m
%
% Set the default font names and sizes for the eps figures
% prepared for Scientific Word
% In SW, a 65-50% reduction of the figures is normally done
% Full LaTeX commands can be used in the labels, legends, etc.
%
%
set(0,'DefaultAxesFontName','Times New Roman');
set(0,'DefaultTextFontName','Times New Roman');
set(0,'DefaultAxesFontSize',18);
set(0,'DefaultTextFontSize',18);
set(0,'defaulttextinterpreter','latex'); % Use LaTeX to add Math symbols
disp(' ');
disp(' Changing Default Font to Times New Roman');
disp(' Changing Default Font Size to 18');
disp(' ');

Это мой текущий код:

x = linspace(0,2);
y1 = sin(2*pi*x);
y2 = exp(-0.5*2*pi*x).*sin(2*pi*x);

figure
subplot(2,1,1);
hPlot1 = plot(x,y1,'rs');

set(gca,'YLim',[-1 2],'YTick',-1:1:2,'XTick',0:.5:2)

subplot(2,1,2);
hPlot2 = plot(x,y2,'k*');

set(gca,'YTick',[-0.2,0,0.2,0.4,0.6],'XTick',0:.5:2)

person Paul Ryan    schedule 11.12.2014    source источник


Ответы (1)


Чтобы изменить метки, вам нужно получить дескриптор самой метки. Фиксированный код:

x = linspace(0,2);
y1 = sin(2*pi*x);
y2 = exp(-0.5*2*pi*x).*sin(2*pi*x);

figure
subplot(2,1,1);
hPlot1 = plot(x,y1,'rs');

set(gca,'YLim',[-1 2],'YTick',-1:1:2,'XTick',0:.5:2)
set(get(gca,'XLabel'),'String','X axis label 1') %get the handle to XLabel and set its value 
set(get(gca,'YLabel'),'String','Y axis 1') %get the handle to YLabel and set its value 

subplot(2,1,2);
hPlot2 = plot(x,y2,'k*');

set(gca,'YTick',[-0.2,0,0.2,0.4,0.6],'XTick',0:.5:3)
set(get(gca,'XLabel'),'String','X axis label 2') %get the handle to XLabel and set its value 
set(get(gca,'YLabel'),'String','Y axis 2') %get the handle to YLabel and set its value 
person Mendi Barel    schedule 11.12.2014