noamgot
noamgot

Reputation: 4091

offset in the x-axis using bar function (matlab)

I genereated a graph in matlab using the following code:

epsilons = 0.1:0.1:1;
RMS = zeros(length(epsilons));
%some data manipulations, changing the RMS to real values
figure;
bar(epsilons , RMS);

as you can see, epsilons contains 10 values: 0.1, 0.2, ..., 1

however, using the bar function I get an offset, as can be seeb in this pic: enter image description here

any ideas how to fix this?

Upvotes: 0

Views: 332

Answers (1)

Andrei Davydov
Andrei Davydov

Reputation: 315

These looks like your RMS is not a vector, but matrix with zero (or NAN) values outside of first column. So, you need just display RMS first column:

bar(epsilons , RMS(:,1));

Upvotes: 2

Related Questions