MATLAB Answers

If the values are almost equal to each other,how do i plot the figure to see its curve? (not straight line )

6 views (last 30 days)
yang-En Hsiao
yang-En Hsiao on 2 Oct 2019
Answered: Adam Danz on 2 Oct 2019
If the values are very similar to each other,how should draw them to see their different?
I mean if the window show me
when a = 1, x1 = 1.111*10^-4
when a = 2, x1 = 1.111*10^-4
when a = 3, x1 = 1.111*10^-4
when a = 4, x1 = 1.111*10^-4
However, each x1 are not the same actually when the a is different however,they are too equal to realize they are not the same from the command window ,how do i plot the figure to see its curve? (not straight line )
i mean the window show me x1 are the same,but actually they are not the same,they are just very very very equal to each other,then how do i write there curve?
i don't want to see the straight line,it should be the curve,because x1 are atually not the same with each other x1

Answers (2)

M on 2 Oct 2019
I am not sure to understand the question, but the following code answer your question ?
a=[1 2 3 4];
x=[x1 x2 x3 x4]; % your different values of x1
M on 2 Oct 2019
Did you try to change the precision of the axis ?
In addition, what is the difference between your x values ?
I did the following test and you can actually see a difference between the values:
a=[1 2 3];
x=[1 1+10*eps 1-10*eps]

Sign in to comment.

Adam Danz
Adam Danz on 2 Oct 2019
Depending on the range of your data, it may be difficult to see the differences when, in fact, the differences are miniscule. In addition to plotting the raw data, you could create an additional plot that shows the difference between the lines.
Here's a demo that plots 3 lines that vary by tiny amounts along the y-axis, too small to see. The second subplot shows the difference between the lines at each x-coordinate.
x = 1:.1:5;
y1 = x + rand(size(x))/100000;
y2 = x + rand(size(x))/100000;
y3 = x + rand(size(x))/100000;
s1 = subplot(2,1,1);
hold on
title('raw data')
s2 = subplot(2,1,2);
hold on
ylabel('difference in y')
title('difference in y')
191002 100927-Figure 1.png
% zoom into the raw data to see difference
191002 100955-Figure 1.png


Community Treasure Hunt

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

Start Hunting!