Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,208,074 members, 8,001,412 topics. Date: Wednesday, 13 November 2024 at 10:11 AM

Mathlab: Help, Help, Help - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / Mathlab: Help, Help, Help (936 Views)

HELP HELP HELP ........I NEED ADMIN FEAUTURES IN MY FORUM / Help!!! Help!!! How To Make Enemy Follow Player In Javafx / Help : Help (2) (3) (4)

(1) (Reply)

Mathlab: Help, Help, Help by Nobody: 12:44pm On Nov 26, 2010
I dont know what is wrong. trying to plot graphs with the below program but the 'end' at the last line is bringing an error message program ends prematurely. What am i doing wrong, pls help me now,



energy demand model
format short e
enegy demand between 1995-2006.
energy demand =(8292.0e+6);
(8698.9e+6);
(9998.3e+6);
(9593.9e+6);
(9435.9e+6);
(9051.7e+6);
(8843.7e+6);
(8521.2e+6);
(8576.3e+6);
(8688.9e+6);
(9034.6+6);
(9079.7+6);
%computing the population figure between 1995-2006.
population '='[(88514501)];
(90992902);
(93540708);
(96159848);
(98852324);
(101620189);
(104465554);
(107390589);
(110397526);
(113488657);
(116666339);
(119932997);
%computing an estimated population growth @2%increase [2007-2021]
population '='[(123291121)];
(126743272);
(130292084);
(141003542);
(142690589);
(144545926);
(145509212);
(149583470);
(153771807);
(158077418);
(162503586);
(167053686);
(171731189);
(176539662);
(181482773);
%statistic of gross domestic product from 1995-2006
GDP=[(32024.4e+6);
(544330.6+6);
(691606.8e+6);
(911091.3e+6);
(1960689.0e+6);
(2740459.0e+6);
(2834998.9e+6);
(2765670.0e+6);
(3193660.0e+6);
(4842190.0e+6);
(5545410.0e+6);
(5726190.0e+6);
%statistic interpolation/estimation from 2007-2021]
GDP '=' (5897975.7e+6);
(6074916.0e+6);
(6444877.3e+6);
(6638224.0e+6);
(6638224.0e+6);
(7042492.1e+6);
(7253767.0e+6);
(7471380.0e+6);
(7695521.4e+6);
(7926387.0e+6);
(8164178.0e+6);
(8409104.0e+6);
(8661377.1e+6);
(8921218.4e+6);
year '=' 1995-2006;
yr1 '=' 2006:2021;
K1 '=' 17.593;%constants(1)
K2 '=' 4.603E-2;%constants(2)
K3 '=' 0.496;%constants(3)
energy demand1 '=' K1+K2*log(population)+K3*log(GDP);
energy demand1 '=' exp(ones(15,1).*K1+(log(population)).*K2+(log(GDP)).*K3);
%energy demand
energy demand1
figure(1)
plot(year,enegrydemand1,'r')
grid
xlabel('time [yr.1995 to yr.2006]')
ylabel('energy demand[kwh]')
title('plot of energy demand against time(year)')
figure(2)
%plot(yr1,energy demand1,'r')
%grid
xlabel('time [yr.1995 - yr.2006]')
ylabel('energy demand[kwh]')
title('plot of energy demand against time(year)')
'end'

%early industrial consumption
%computing the yearly industrial consumption 1995-2006
yearlyindconsumpt '=' [(2042.3e+6);
(2177.0e+6);
(2066.9e+6);
(2043.5e+6);
(2037.2e+6);
(2061.3e+6);
(2074.0e+6);
(1918.0e+6);
(1861.1e+6);
(1911.6e+6);
(1987.2e+6);
(1976.3e+6);
figure(1);
time '=' 1995:1:2006
plot(time,yearlyindconsumpt);
(grid)
xlabel('time [year,1995-2006]');
ylabel('industrial consumption [kwh]');
'end'
%computing the yearly commercial consumption 1995-2006
yrlyComConsumpt '=' [(2225.9e+6);
(2181.6e+6);
(2714.4e+6);
(2513.6e+6);
(2448.9e+6);
(2452.8e+6);
(2317.4e+6);
(2222.1e+6);
(2296.4e+6);
(2346.0e+6);
(2439.0e+6);
figure(1);
time '=' 1995:1:2006;
plot(time,yrlyComConsumpt);
grid on
xlabel('time [year,1995 to 2006]');
ylabel('yearly commercial consumption [kwh]');
'end'

%computing the yearly residential consumption from 1995-2006.
YearlyResConsumpt '=' [(4023.8e+6);
(4340.3e+6);
(5217.0e+6);
(5036.8e+6);
(4949.8e+6);
(4537.6e+6);
(4452.3e+6);
(4381.1e+6);
(4416.8e+6);
(4431.3e+6);
(4608.4e+6);
(4640.0e+6);
figure(1);
time '=' 1995:1:2006;
plot(time,yearlyresconsumpt);
grid on
xlabel('time [year,1995-2006]');
y label('yearlyresconsumpt [Kwh]');
title('plot of yearly residential consumption against time');
'end'

%electric supply
%computing the electricity supply model.
format short e
electsupply '=' [(14166.6e+6);
(14833.8e+6);
(14504.6e+6);
(15531.0e+6);
(15856.6e+6);
(16242.8e+6);
(16116.9e+6);
(15110.0e+6);
(16088.7e+6);
(14727.0e+6);
(15463.0e+6);
(15308.4e+6);
basesupply '=' (13462.9e+6);
T '=' 12
'for' n '=' 1:15
CardinalNoOf yr_t(n,1) '=' T -(1+n);
end
CardinalNoOf yr_t
year '=' (1995:2006);
year1 '=' 2007:2021;
%electsupply1=baseyrsupply+b*CardinalNoOf yr_t
%
%b=14869.976
'for' n '=' 1:15
electsupply1(n,1) '=' baseyrsupply+CardinalNoOf yr_t(n,1);
'end'
%electsupply
electsupply1
figure(1);
plot(year,electsupply)
grid
xlabel('time[yr-1995 to yr-2006]')
y label('electricity supply [Kwh]');
title ('plot of electric supply against Time[year]')
figure(2);
plot(year1,electsupply1)
grid
xlabel('Time[yr-2007 to -2021]')
ylabel('electricsupply[Kwh]')
title('plot of electric supply against Time[year1]')
'end'
%total consumption (industrial,commercial and residential)
%computing the yearly residential consumption from 1995-2006.
yrlyresconsumpt '=' (4023.8e+6);
(4340.3e+6);
(5217.0e+6);
(5036.8e+6);
(4949.8e+6);
(4537.6e+6);
(4452.3e+6);
(4381.1e+6)
(4416.8e+6);
(4431.3e+6);
(4608.4e+6);
(4640.0e+6);
%computing the yearly projection of residential consumption from
%2007-2021
yrlyresconsumpt1 '=' (4820.0e+6);
(5008.0e+6);
(5203.3e+6);
(5406.2e+6);
(5617.0e+6);
(5836.1e+6);
(6063.7e+6);
(6300.2e+6);
(6545.9e+6);
(6801.2e+6);
(7066.4e+6);
(7341.0e+6);
(7627.3e+6);
(7341.0e+6);
(7627.3e+6);
(7924.8e+6);
(8233.9e+6);
%computing the yearly commercial consumption from 1995-2006
yrlyconsumpt '=' (2225.9e+6);
(2181.6e+6);
(2714.4e+6);
(2513.6e+6);
(2448.9e+6);
(2452.8e+6);
(2317.4e+6);
(2222.1e+6);
(2296.4e+6);
(2346.0e+6);
(2439.0e+6);
(2463.4e+6);
%computing the yearly projection of commercial consumption from
%2007-2021
yrlyconsumpt1 '=' (2584.1e+6);
(2710.7e+6);
(2843.5e+6);
(2982.8e+6);
(3129.0e+6);
(3282.3e+6);
(3443.1e+6);
(3612.0e+6);
(3789.0e+6);
(3975.0e+6);
(4169.7e+6);
(4588.3e+6);
(4374.0e+6);
(4813.1e+6);
(5048e+6);
%computing the yearly industrial consumption from 1995-2006
yrlyindconsumpt '=' [(2042.3e+6);
(2177.0e+6);
(2066.9e+6);
(2043e+6);
(2037e+6);
(2061.3e+6);
(2074.0e+6);
(1918.0e+6);
(1861.1e+6);
(1911.6e+6);
(1987.2e+6);
(1976.3e+6);
%computing the yearly industrial consumption from 2007-2021
yrlyindconsumpt1 '=' [(2057.3e+6);
(2141.6e+6);
(2227.3e+6);
(2316.4e+6);
(2401.1e+6);
(2505.5e+6);
(2605.7e+6);
(2709.9e+6);
(2818.3e+6);
(2931.0e+6);
(3048.2e+6);
(3170.1e+6);
(3296.9e+6);
(3428.8e+6);
(3565.0e+6)];
year1 '=' (1995:2006);
year1 '=' (2007:2021);
format short e
K' '='-8.8097%constants1(1)
d '=' 1.0000%constants1(2)
e '=' 1.0000%constants1(3)
f '=' 1.0000%constants1(4)
totalconsumpt '= ' K+d*yrlyresconsumpt+e*yrlyconsumpt+f*yrlyindconsumpt;

totalconsumpt1 '= ' K+d*yrlyresconsumpt+e*yrlyconsumpt1+f*yrlyindconsumpt1;
%totalconsumpt
figure(1);
plot(year,totalconsumpt,'b')
grid
xlabel('time[year-1995 to year 2006]')
ylabel('totalconsumpt[Kwh]')
title('plot of totalconsumption against time[year]')
figure(2);
plot(year1, totalconsumpt1,'b')
grid
xlabel('time[year]2007-2021')
ylabel('totalconsumption [Kwh]')
title('plot of totalconsumption against time [year1]')
end
%computing the population figure between 1995-2006.
population '=' [(88514501);
(90992907);
(93540708);
(96159848);
(98852324);
(101620189);
(104465554);
(107390589);
(110397526);
(113488657);
(116666339);
(119932997);
%computing an estimated population growth @2% increase [2007-2021]
population1 '= ' [(123291121);
(126743272);
(130292084);
(141003542);
(142690589);
(144545926);
(145509212);
(149583470);
(153771807);
(158077418);
(162503586);
(167053686);
(171731189);
(176539662);
%statistic of gross domestic product from 1995-2006
gdp '=' (32024.4e+6);
(544330.6e+6);
(691606.8e+6);
(911091.3e+6);
(1960689.0e+6);
(2740459.0e+6);
(2834998.9e+6);
(2765670.0e+6);
(3193660.0e+6);
(4842190.0e+6);
(5545410.0e+6);
(5726190.0e+6);
statistic interpolation/estimation from 2007-2021
gdp '=' (5897975.7e+6);%2007 gdp data
(6074916.0e+6);
(6257162.4e+6);
(6444877.3e+6);
(6638224.0e+6);
(6638224.0e+6);
(7042492.1e+6);
(7253767.0e+6);
(7471380.0e+6);
(7695521.4e+6);
(7926387.0e+6);
(8164178.6e+6);
(8409104.0e+6);
(8661377.1e+6);
(8921218.4e+6);
year '=' 1995:2006;
yr1 '=' 2007:2021;
K1 '=' 17.593;%constants(1)
K2 '=' 4.603e-2;%constants(2)
K3 '=' 0.496;%constants(3)
energy demand1 '=' K1+K2*log(population)+K3*log(gdp),constants '= ' regress(log(energydemand), ones(12,1)(log(population))(log(gdp)));
%energydemand=exp(ones(15,1).*K1+(log(population)).*K2+(log(gdp).*K3)
%energydemand
'end'
Re: Mathlab: Help, Help, Help by DapoBear(m): 12:42am On Dec 04, 2010
Why do you have:


'end'


rather than just

end

?

Same with
'='
.

(1) (Reply)

Ball Mill Information / Seun Is Trying To Rebuild Programming Section / Code Wrestling Entertainment: Sharpen Ur Skill!!!

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 45
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.