Plot a graph from the given table

3 次查看(过去 30 天)
I want to plot this table and graph in matlab. Can anyone help me with this.
  1 个评论
Sreeja Poreddy
Sreeja Poreddy 2021-2-26
x=[1 2 3 4 5 6 7 8 9 10 11]';
y1=[34 81 92 94 211 222 233 234 312 336 372]';
y2=[36 98 100 108 254 275 275 275 350 350 381]';
y3=[2 17 8 14 43 53 42 41 38 14 9]';
f=figure;
subplot(121);
plot(x,y1,y2,y3);
data=[x,y1,y2,y3];
colNames={'X-Data','Y-Data'};
t=uitable(f,'Data',data,'Position',[300,100,200,300],'ColumnName',colNames);
I tried doing it like this, But it does not seem to be working.

请先登录,再进行评论。

采纳的回答

KALYAN ACHARJYA
KALYAN ACHARJYA 2021-2-27
编辑:KALYAN ACHARJYA 2021-2-27
Graph:
Please do learn about line/plot design here
simu_result=[34 81 92 94 211 222 233 234 312 336 372];
ana_result=[36 98 100 108 254 275 275 275 350 350 381];
dif_data=ana_result-simu_result;
plot(case_data,simu_result,'-sb','MarkerEdgeColor','k','MarkerFaceColor','b');
hold on;
plot(case_data,ana_result,'-dr','MarkerEdgeColor','k','MarkerFaceColor','r');
plot(case_data,dif_data,'-vy','MarkerEdgeColor','k','MarkerFaceColor','y');
ax = gca;
ax.XGrid = 'off';
ax.YGrid = 'on';
xlim([1 11]);
ylim([0 450]);
ylabel('Counter Increments');
xlabel('Case');
title('Simulated vs. Analytical Values')
Hope you can do add legend
For Table:
T=table(simu_result',ana_result',dif_data');
T.Properties.VariableNames={'Simulation Result' 'Analytical Result' 'Difference'}
T

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 2-D and 3-D Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by