Problem with semilogx plot

3 views (last 30 days)
NGUYEN  Quang Hung
NGUYEN Quang Hung on 13 Jun 2014
Commented: Star Strider on 13 Jun 2014
I have a Particle-size distribution of a powder like this image:
from the raw data in the excel sheet , I have imported into the matlab an run the following code:
clc
clear all
close all
irl= xlsread('granulo','irl');
dia_irl= irl(:,1); cum_irl= irl(:,2);
figure;
hold all;
semilogx(dia_irl, cum_irl);
xlabel('Diamètre, \mum');
ylabel('Cumulative value');
But I can get the graph like the above, how can I do?
Best regard

Accepted Answer

Star Strider
Star Strider on 13 Jun 2014
This is not exactly the same as your example plot, probably because your data are not the same, but it is close:
irl = xlsread('granulo','irl');
dia_irl = irl(:,1);
cum_irl = irl(:,2);
hst_irl = irl(:,3); % Histogram data for bar plot‘’
figure(1)
plot(log10(dia_irl), cum_irl, '-r') % Plot of ‘cum_irl’ on log10 of ‘dia_irl’
hold on
bar(log10(dia_irl), hst_irl) % Bar of ‘hst_irl’ on log10 of ‘dia_irl’
hold off
grid
logxts = [-2:2 log10(500.1)]; % Desired log10 'XTick'
set(gca, 'XTick', logxts) % Set new 'XTick' locations
expxts = 10.^(logxts); % Take antilog to use them as new ‘XTickLabels’
set(gca, 'XTickLabel', floor(1*expxts)/1) % Format labels
axis([min(logxts) max(logxts) 0 100])
The plot:
  2 Comments
NGUYEN  Quang Hung
NGUYEN Quang Hung on 13 Jun 2014
Many thanks Star Strider, now I understand the logscale :)
Star Strider
Star Strider on 13 Jun 2014
My pleasure!

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!