Plot a graph from the given table

3 vues (au cours des 30 derniers jours)
Sreeja Poreddy
Sreeja Poreddy le 26 Fév 2021
Commenté : Sreeja Poreddy le 27 Fév 2021
I want to plot this table and graph in matlab. Can anyone help me with this.
  1 commentaire
Sreeja Poreddy
Sreeja Poreddy le 26 Fév 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.

Connectez-vous pour commenter.

Réponse acceptée

KALYAN ACHARJYA
KALYAN ACHARJYA le 27 Fév 2021
Modifié(e) : KALYAN ACHARJYA le 27 Fév 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
  1 commentaire
Sreeja Poreddy
Sreeja Poreddy le 27 Fév 2021
Thank you so much! It's working.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by