Matlab breaks the X axis

I have a problem displaying a graph that works from 0-10K . I currently have a calculation from 0 to 100, and it looks great.

Currently

enter image description here

Now I want to add one X-point, which is 10K. And it looks like this: enter image description here

How can I save it from 0-100 and show only when transitions to 10K ? Is it possible?

The problem is that 0-100 is a very small part in 10K, so it looks bad.

+4
source share
2 answers

x, XTick XTickLabel, , . :

plot([1:20 25], 1./[1:20 10000]);
set(gca, 'XTick', [2:2:20 25], ...
         'XTickLabel', strtrim(cellstr(int2str([2:2:20 10000].'))));

, :

enter image description here

+4

, ( ) . x ( , ). .

:

clear;
close all;
clc;

gap1 = 0.2;
x_left = 1:gap1:3;
gap2 = 0.5;
x_right = 3+gap2:gap2:6;
x_ticks_for_plot = [x_left x_right];

x=x_ticks_for_plot;
y = sin(x);
plot(x,y);
xticks(x_ticks_for_plot);

:

enter image description here

, , .

+2

Source: https://habr.com/ru/post/1684705/


All Articles