我正在尝试为我的期末练习基本复制这个图表,但我不知道如何更改字体、大小或标记轴。简而言之,我需要从我的代码中完全复制此图表。我需要字体为Times New Roman、大小为18,标记大小为8。我该如何将我的代码格式化为此格式?
这是我的代码:
这是我的代码:
clear
clc
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');
ylabel('f(t)')
set(gca,'YLim',[-1 2],'YTick',-1:1:2,'XTick',0:.5:2)
subplot(2,1,2);
hPlot2 = plot(x,y2,'k*');
xlabel('Time(s)')
ylabel('g(t)')
set(gca,'YLim',[-0.2,0.6],'YTick',[-0.2,0,0.2,0.4,0.6],'XTick',0:.5:2)
text(0.5,1.5,'Harmonic force f(t) = sin(\omega t)','interpreter','latex')
。 - am304