Show minor changes in numbers
Show older comments
Hello
Can someone help me with this code
I want all changes between each variable
to appear not on one line Is there a solution in the code? or even in properties of the figure?
clc
clear
close all;
T=[36.1372, 448.2709, 604.4290, 609.5042, 611.0202, 612.1450, 612.2992, 612.7632, 613.5447, 613.4673, 614.2219, 613.9967, 614.2976, 613.8676, 614.1823, 614.5736];
S=[27.7774, 31.1058, 35.6129, 45.5727, 366.2270, 599.8439, 611.3228, 614.6429, 614.7070, 615.1051, 616.4094, 616.5185, 617.0064, 616.8854, 617.5152, 617.2996];
X=[27.2861, 29.5792, 32.1488, 34.4917, 38.2366, 43.1211, 55.4350, 293.9357, 601.7387, 612.5882, 618.4006, 620.7390, 619.7454, 619.0197, 620.6559, 621.5188];
Z=[27.0137, 29.1379, 32.0862, 34.2656, 36.0955, 39.0952, 42.6568, 46.9772, 53.4866, 70.5881, 331.0303, 613.1030, 623.2177, 625.8538, 627.7745, 630.0455];
u=1300000:100000:2800000;
ax= subplot(1,1,1);
plot(u(1:16),T(1:16),'-o b', 'LineWidth',1.5,'MarkerSize',6)
hold on
plot(u(1:16),S(1:16),'-.* r','LineWidth',1.5,'MarkerSize',6)
plot(u(1:16),X(1:16),'-+ m','LineWidth',1.5,'MarkerSize',6)
plot(u(1:16),Z(1:16),'-.s g','LineWidth',1.5,'MarkerSize',6)
grid on
legend('vr=14','vr=17','vr=20','vr=23')
xlabel('Messages arrival rate(Messages/s)')
ylabel('Mean number of requests(Messages)')
3 Comments
John D'Errico
on 10 Jan 2023
What do you mean by changes? What exactly do you want to see, as your question is quite confusing.
Certainly it is trivial to compute the differnce between two variables. Just plot that, if that is what you want to see.
What do you mean by something in the properties of the figure? When is a change minor? Explain your question. Show what you WANT to see computed, as an example.
Nourah
on 10 Jan 2023
Adam Danz
on 10 Jan 2023
@Nourah, when I saw your question and your plot I thought I was having daja vu. You asked this same question (and a very similar plot) twice last June.
- https://www.mathworks.com/matlabcentral/answers/1747765
- https://www.mathworks.com/matlabcentral/answers/1744450
Looks like you got lots of helpful and duplicate advice. @Walter Roberson's answer below differs from the answers in your previous threads - I hope this is will be solution you are looking for.
Answers (1)
T=[36.1372, 448.2709, 604.4290, 609.5042, 611.0202, 612.1450, 612.2992, 612.7632, 613.5447, 613.4673, 614.2219, 613.9967, 614.2976, 613.8676, 614.1823, 614.5736];
S=[27.7774, 31.1058, 35.6129, 45.5727, 366.2270, 599.8439, 611.3228, 614.6429, 614.7070, 615.1051, 616.4094, 616.5185, 617.0064, 616.8854, 617.5152, 617.2996];
X=[27.2861, 29.5792, 32.1488, 34.4917, 38.2366, 43.1211, 55.4350, 293.9357, 601.7387, 612.5882, 618.4006, 620.7390, 619.7454, 619.0197, 620.6559, 621.5188];
Z=[27.0137, 29.1379, 32.0862, 34.2656, 36.0955, 39.0952, 42.6568, 46.9772, 53.4866, 70.5881, 331.0303, 613.1030, 623.2177, 625.8538, 627.7745, 630.0455];
u=1300000:100000:2800000;
u16 = u(1:16);
T16 = T(1:16);
S16 = S(1:16);
X16 = X(1:16);
Z16 = Z(1:16);
vars = {T16, S16, X16, Z16};
varnames = ["T", "S", "X", "Z"];
numvars = length(vars);
tiledlayout('flow');
for idx1 = 1 : numvars-1
for idx2 = idx1+1 : numvars
nexttile()
plot(u16, vars{idx1}-vars{idx2});
title(varnames(idx1) + " minus " + varnames(idx2));
end
end
With the differences being up to 500, if you had a need to see even small differences, then you would need to plot each of those as an entire figure so that you could get maximum magnification.
Categories
Find more on Spreadsheets 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!
