Problem with semilogx plot

3 Ansichten (letzte 30 Tage)
NGUYEN  Quang Hung
NGUYEN Quang Hung am 13 Jun. 2014
Kommentiert: Star Strider am 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

Akzeptierte Antwort

Star Strider
Star Strider am 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 Kommentare
NGUYEN  Quang Hung
NGUYEN Quang Hung am 13 Jun. 2014
Many thanks Star Strider, now I understand the logscale :)
Star Strider
Star Strider am 13 Jun. 2014
My pleasure!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Log Plots finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by