필터 지우기
필터 지우기

I need to draw the annexed Excel draw with MATLAB code

조회 수: 3 (최근 30일)
Moustafa Abedel Fattah
Moustafa Abedel Fattah 2024년 4월 11일
답변: Voss 2024년 4월 11일
I have a draw with Excel and I need please a MATLAB code to redraw it
Please see the annexed file
Thanks in advance

답변 (1개)

Voss
Voss 2024년 4월 11일
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';

카테고리

Help CenterFile Exchange에서 Axis Labels에 대해 자세히 알아보기

태그

제품


릴리스

R2014b

Community Treasure Hunt

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

Start Hunting!

Translated by