help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Problem with axis on bar graphs


From: andrewcd
Subject: Problem with axis on bar graphs
Date: Sun, 29 Apr 2012 21:01:38 -0700 (PDT)

Hi All,

I am trying to plot some really basic modeling results, and I am having
trouble getting the axis labeling to behave.  My code is below: it gives me
a bar graph that has the values in the wrong places.  Does anyone know how
this could be fixed?

I am using octave 3.2.3 on Ubuntu, 64 bit.



clear all
cd  "/home/andrew/Documents/Berkeley/Labs/Torn/Greenhouse"

cvol = .9144*3.6576*1.8         %Chamber size in cubic meters
carea = cvol/1.8                                %Square meterage
tha     =12                                             %t/ha equivalent
maxbio = tha/10*carea*1000                      %maximum biomass in chamber, in 
grams
initialbio = 10                                 %"initial" biomass, in grams
d = 180                                         %number of days it takes to get 
to maxbio
grate = maxbio/d                                %growth rate per day, assuming 
linear growth
rp = .5                                         %respiration/photosynthesis 
ratio
molperm3 = 40                           %simplifying moles per cubic meter down 
to a constant
airmass = molperm3*cvol*29      %Mass of chamber air, in grams
ppm_amb = 380                           %ambient ppm CO2
lowersetpoint = 250                     %equivalent to 2.65 g CO2 in air
uppersetpoint = 430                     %equivalent to 4.55 g CO2 in air
gco2per_gair = 44/29*380/10^6   %Mass co2 per mole air
gco2 = gco2per_gair*airmass     %Mass CO2 per chamber
t = 6                                           %times per hour to run algorithm

r = log(maxbio/initialbio)/d  %growth rate

l0 = 0
l1 = 0
l2 = 0
l3 = 0
l4 = 0
l5 = 0
l6 = 1
l7 = 1
l8 = 1
l9 = 1
l10 = 1
l11 = 1
l12 = 1
l13 = 1
l14 = 1
l15 = 1
l16 = 1
l17 = 1
l18 = 1
l19 = 1
l20 = 1
l21 = 1
l22 = 0
l23 = 0

light = [l0 l1 l2 l3 l4 l5 l6 l7 l8 l9 l10 l11 l12 l13 l14 l15 l16 l17 l18
l19 l20 l21 l22 l23  ]

mass = initialbio
conc = []
inc = []
for day = 1:180
        
dWdt = mass*e^r-mass;
phot = dWdt/(1-rp);
resp = phot*rp;


for h = 1:24*t
        wtminus1 = mass;
        if light(ceil(h/t)) == 0
                mass = mass-resp/(24*t);
        else
                mass = mass  + phot/(16*t)-resp/(24*t);
                endif
        
        balance = wtminus1-mass;
        gco2 = gco2+balance*44/12;
        
        if gco2 < gco2per_gair*airmass*lowersetpoint/ppm_amb
                gco2 = gco2per_gair*airmass*uppersetpoint/ppm_amb;
                endif
        C(h,day) = gco2;
        masslog(h,day) = mass;
        
        
        if light(ceil(h/t)) == 1
                conc(length(conc)+1) = gco2/airmass*29/44*10^6;
                inc(length(inc)+1) =  phot/(16*t)-resp/(24*t);
                endif
        end

end
        logg = reshape(C,(24*t*day),1)/airmass*29/44*10^6;
        %logg = log(logg)
        %plot(logg)
        masslogg = reshape(masslog,(24*t*day),1);
        %plot(masslogg)

L250 = sum((conc<250).*inc)
L350 = sum((conc<350).*inc)-L250
L425 = sum((conc<425).*inc)-L250-L350
L600 = sum((conc<600).*inc)-L250-L350-L425
L1000 = sum((conc<1000).*inc)-L250-L350-L425-L600
L5000 = sum((conc<5000).*inc)-L250-L350-L425-L600-L1000
LG = sum((conc>=5000).*inc)

y  = [L250 L350 L425 L600 L1000 L5000 LG]'
lab  = ["<250"; "<350"; "<425"; "<600"; "<1000"; "<5000"; ">5000"]
bar(y)
set(gca,'XTickLabel',lab);





--
View this message in context: 
http://octave.1599824.n4.nabble.com/Problem-with-axis-on-bar-graphs-tp4597405.html
Sent from the Octave - General mailing list archive at Nabble.com.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]