Plot a graph from the given table

2 views (last 30 days)
I want to plot this table and graph in matlab. Can anyone help me with this.
  1 Comment
Sreeja Poreddy
Sreeja Poreddy on 26 Feb 2021
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.

Sign in to comment.

Accepted Answer

KALYAN ACHARJYA
KALYAN ACHARJYA on 27 Feb 2021
Edited: KALYAN ACHARJYA on 27 Feb 2021
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

More Answers (0)

Categories

Find more on Deep Learning Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!