plot a data????
3 views (last 30 days)
Show older comments
I am trying to plot this table below in the picture

Please check my code and make any correction
A=[
5 99.11 5 412
10 99 5 405.25
15 98.91 5 397.85
20 98.81 5 389.73
25 98.71 5 381.13
30 98.61 5 371.97
];
F = figure;
F.Position = [100 100 800 400];
subplot(1,2,1);
plot(A(:,1),A(:,3),'-bo','linewidth',1.5);grid on;hold on;
plot(A(:,1),A(:,4),'-ro','linewidth',1.5);grid on;
str = {'(A)'};
text(10,80,'A','FontSize',14,'FontWeight','bold')
xlabel('Excess Air','FontWeight','bold');
ylabel('Purity CO2','FontWeight','bold')
legend('1^{st} stage','2^{nd} stage','Location','NorthEast')
subplot(1,2,2);
plot(A(:,1),A(:,2),'-go','linewidth',1.5);grid on;hold on;
plot(A(:,1),A(:,5),'-ko','linewidth',1.5);grid on;
str = {'(B)'};
text(13,.77,'B','FontSize',14,'FontWeight','bold')
xlabel('Excess Air','FontWeight','bold');ylabel('Stage Cut','FontWeight','bold')
legend('Overall','Stage cut','Location','NorthEast')
subplot(1,2,1)
legend("Position", [0.28832,0.31347,0.16722,0.12086])
subplot(1,2,2)
legend("Position", [0.73589,0.33223,0.16556,0.10762])
0 Comments
Answers (1)
Star Strider
on 17 Nov 2022
It appears to run correctly, unless there is a quesiton you are not stating.
There are only 4 columns in ‘A’ so this threw the expected error:
plot(A(:,1),A(:,5),'-ko','linewidth',1.5);grid on;
With that correction, it produces the result here —
A=[
5 99.11 5 412
10 99 5 405.25
15 98.91 5 397.85
20 98.81 5 389.73
25 98.71 5 381.13
30 98.61 5 371.97
];
F = figure;
F.Position = [100 100 800 400];
subplot(1,2,1);
plot(A(:,1),A(:,3),'-bo','linewidth',1.5);grid on;hold on;
plot(A(:,1),A(:,4),'-ro','linewidth',1.5);grid on;
str = {'(A)'};
text(10,80,'A','FontSize',14,'FontWeight','bold')
xlabel('Excess Air','FontWeight','bold');
ylabel('Purity CO2','FontWeight','bold')
legend('1^{st} stage','2^{nd} stage','Location','NorthEast')
subplot(1,2,2);
plot(A(:,1),A(:,2),'-go','linewidth',1.5);grid on;hold on;
plot(A(:,1),A(:,4),'-ko','linewidth',1.5);grid on;
str = {'(B)'};
text(13,.77,'B','FontSize',14,'FontWeight','bold')
xlabel('Excess Air','FontWeight','bold');ylabel('Stage Cut','FontWeight','bold')
legend('Overall','Stage cut','Location','NorthEast')
subplot(1,2,1)
legend("Position", [0.28832,0.31347,0.16722,0.12086])
subplot(1,2,2)
legend("Position", [0.73589,0.33223,0.16556,0.10762])
Are there any other problems?
.
0 Comments
See Also
Categories
Find more on Subplots 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!