Effacer les filtres
Effacer les filtres

I need to draw the annexed Excel draw with MATLAB code

3 vues (au cours des 30 derniers jours)
Moustafa Abedel Fattah
Moustafa Abedel Fattah le 11 Avr 2024
Réponse apportée : Voss le 11 Avr 2024
I have a draw with Excel and I need please a MATLAB code to redraw it
Please see the annexed file
Thanks in advance

Réponses (1)

Voss
Voss le 11 Avr 2024
x = [-5.5,-5,-4.5,-3.5,-2.5,-1.5,0,1.5,2.5,3.5,4.5,5,5.5];
y = [-0.002,-0.004,-0.005,-0.008,-0.008,-0.014,-0.014,-0.014,-0.008,-0.008,-0.005,-0.004,-0.002];
xi = linspace(min(x),max(x),100);
yi = interp1(x,y,xi,'spline');
figure();
hold on
plot(x,y,'.', ...
'Color',[0.65,0.65,0.65], ...
'MarkerSize',10)
plot(xi,yi,'-', ...
'Color',[0.65,0.65,0.65], ...
'LineWidth',1.5)
h_lgd = plot(NaN,NaN,'.-', ...
'Color',[0.65,0.65,0.65], ...
'MarkerSize',10, ...
'LineWidth',1.5);
legend(h_lgd,'g_M', ...
'Location','SouthOutside', ...
'Interpreter','none', ...
'Box','off')
ax = gca();
set(ax.Title, ...
'String','g_M', ...
'Interpreter','none', ...
'FontSize',12, ...
'VerticalAlignment','bottom', ...
'Position',[0 0.0025], ...
'FontWeight','normal')
set(ax, ...
'XLim',[-8,8], ...
'YLim',[-0.016,0], ...
'XAxisLocation','origin', ...
'YAxisLocation','origin', ...
'XGrid','on', ...
'YGrid','on', ...
'XMinorGrid','on', ...
'YMinorGrid','on', ...
'XTick',-8:2:8, ...
'YTick',-0.016:0.002:0, ...
'TickLength',[0 0], ...
'PlotBoxAspectRatio',[4 1 1], ...
'Box','on', ...
'FontSize',9)
ax.XAxis.TickLabelFormat = '%.3f';
ax.YAxis.TickLabelFormat = '%.3f';

Tags

Produits


Version

R2014b

Community Treasure Hunt

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

Start Hunting!

Translated by