Plot a graph from the given table

조회 수: 4 (최근 30일)
Sreeja Poreddy
Sreeja Poreddy 2021년 2월 26일
댓글: Sreeja Poreddy 2021년 2월 27일
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
  댓글 수: 1
Sreeja Poreddy
Sreeja Poreddy 2021년 2월 27일
Thank you so much! It's working.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Deep Learning Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by