How to plot it please help
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Melika Eft
el 22 de Dic. de 2022
Editada: Alberto Cuadra Lara
el 22 de Dic. de 2022
Hi could you please help me how to write a code which output gives me the below diagram thank you
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1239752/1042BA95-92F3-455E-8394-589EB1F4A50F.jpeg)
0 comentarios
Respuesta aceptada
Alberto Cuadra Lara
el 22 de Dic. de 2022
Editada: Alberto Cuadra Lara
el 22 de Dic. de 2022
Hello Melika,
If you want to extract the results, I recommend to use WebPlotDigitizer. This can also be done with MATLAB. Afterwards you can plot it as in the paper, as shown below. If you want to do the simulation this will require more information.
Best,
Alberto
% Load data collected from WebPlotDigitizer
%
% x(:, 1) y(:, 1)
% x(:, 2) y(:, 2)
% x(:, 3) y(:, 3)
% x(:, 4) y(:, 4)
%
% I have collected the data for the first case
[x, y] = load_data();
% Figure settings
config.outerposition = [0.35 0.35 0.6 0.6];
config.linewidth = 2;
config.fontsize = 20;
config.markersize = 12;
config.axis_x = 'tight';
config.axis_y = 'auto';
config.box = 'on';
config.grid = 'on';
config.hold = 'on';
config.labelx = 'Imperfect CSI ($\sigma_{\epsilon}$)';
config.labely = 'Total energy efficiency of V2X network (Mb/J)';
config.legeds = {'AmBC NOMA, $P_{\rm tot}$ = 43 dBm'};
config.legend_location = 'northeast';
% Generate figure
fig = figure;
set(fig, 'units', 'normalized', 'outerposition', config.outerposition);
ax = axes(fig);
% Set settings
set(ax, 'LineWidth', config.linewidth, 'FontSize', config.fontsize - 2)
set(ax, 'BoxStyle', 'full', 'TickLabelInterpreter', 'latex')
set(ax, 'Layer', 'Top');
xlim(ax, config.axis_x);
ylim(ax, config.axis_y);
box(ax, config.box);
grid(ax, config.grid);
hold(ax, config.hold);
xlabel(ax, config.labelx, 'FontSize', config.fontsize, 'interpreter', 'latex');
ylabel(ax, config.labely, 'FontSize', config.fontsize, 'interpreter', 'latex');
% Plot results
plot(ax, x(:, 1), y(:, 1), 'bs-', 'LineWidth', config.linewidth, 'MarkerSize', config.markersize);
% plot(ax, x(:, 2), y(:, 2), 'ks--', 'LineWidth', config.linewidth, 'MarkerSize', config.markersize);
% plot(ax, x(:, 3), y(:, 3), 'bo-', 'LineWidth', config.linewidth, 'MarkerSize', config.markersize);
% plot(ax, x(:, 4), y(:, 4), 'ko--', 'LineWidth', config.linewidth, 'MarkerSize', config.markersize);
% Set legends
legend(ax, config.legeds, 'FontSize', config.fontsize - 2, 'Location', config.legend_location, 'interpreter', 'latex')
% SUB-PASS FUNCTION
function [x, y] = load_data()
% Case 1
x(:, 1) = [0.9916 1.9854 2.9895 3.9937 4.9979 5.9916 6.9958 8.0000 9.0042 10.0084] * 1e-3;
y(:, 1) = [0.0522 0.0369 0.0282 0.0232 0.0186 0.0157 0.0135 0.0119 0.0100 0.0086];
end
Más respuestas (0)
Ver también
Categorías
Más información sobre Line Plots en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!