Files
imdd_silas/test/m2tikz_examples.m
2026-02-19 15:34:53 +01:00

47 lines
1.9 KiB
Matlab

x = -10:2:25; % Input power [dBm]
y1 = 1e-5 * 10.^(0.12*x); % Dispersion-only
y2 = 1e0 ./ (1 + exp(-0.4*(x-12))); % NLPN
y3 = 1e-6 * 10.^(0.45*x); % RP on gamma
y4 = 1e-2 * 10.^(0.18*(x-8)); % RP on beta2
cmap = WesPalette.AsteroidCity1.rgb(4);
cmap = linspecer(4);
figure1=figure(202998);clf;hold on
lw = 0.8; ms = 3;
plot(x,y1,'LineWidth',lw,'Color',cmap(1,:),'Marker','o','MarkerEdgeColor',cmap(1,:),'MarkerFaceColor',[1,1,1],'MarkerSize',ms);
plot(x,y2,'LineWidth',lw,'Color',cmap(2,:),'Marker','square','MarkerEdgeColor',cmap(2,:),'MarkerFaceColor',[1,1,1],'MarkerSize',ms);
plot(x,y3,'LineWidth',lw,'Color',cmap(3,:),'Marker','o','MarkerEdgeColor',cmap(3,:),'MarkerFaceColor',[1,1,1],'MarkerSize',ms);
plot(x,y4,'LineWidth',lw,'Color',cmap(4,:),'Marker','o','MarkerEdgeColor',cmap(4,:),'MarkerFaceColor',[1,1,1],'MarkerSize',ms);
yline(3.8e-3,'HandleVisibility','off')
grid on
xlabel('Input power [dBm]')
ylabel('NSD ($\%$)')
legend({'Dispersion','NLPN','RP','RP on $\beta_2$'}, ...
'Location','best')
grid off
set(gca,'MinorGridLineWidth',0.5);
set(gca,'GridLineWidth',0.5,'GridLineStyle','--','GridColor',[0.9,0.9,0.9]);
set(gca,'FontSize',12,'YScale','log');
ylim([1e-6 1e3])
xlim([-10 23])
fig_path = 'C:\Users\Silas\Documents\Dissertation\00_Examples\tikz\textfig.tikz';
matlab2tikz(fig_path, ...
'width','\fwidth', ...
'height','\fheight', ...
'showInfo',false, ...
'extraAxisOptions',{ ...
'legend style={font=\footnotesize}', ...
'xlabel style={font=\color{white!15!black},font=\small},',...
'ylabel style={font=\color{white!15!black},font=\small},',...
'legend columns=1', ...
'every axis/.append style={font=\scriptsize}',...
'legend columns=2',...
'legend style={at={(0.02,0.98)},font=\footnotesize,draw=black!60,rounded corners=2pt,inner sep=1pt,fill=white,column sep=6pt,anchor= north west}',...
});