# Thread: What is wrong with my matlab function?

1. ## What is wrong with my matlab function?

I have been trying to figure this out for a couple of hours now. Help please.

Okay here is the mfile I'm using. Titled f

function zi = f(x, y)
q = .6; %transmisiivity of solar glazing
s = 1; %absorptivity of adobe walls
c = 0; %thermal capacitance of the maternity house
d = 4.55; %area of solar collector (m^2)
r = 198.63; %1/Rt
e = 5; %ambient temp.
zi =(((q.*s.*c.*d)-((y-e)/r))./c);

Then we typed into the command window the following string:

>> a = 0;
>> b = 86400;
>> y0 = 20;
>> [x,y]=ode45('f',[a,b],y0)

The values resulted in

x = 0.000000000
0.000000000000

etc

y = NaN
NaN
NaN
etc.

These values are obviously wrong, help please!

I have been trying to figure this out for a couple of hours now. Help please.

Okay here is the mfile I'm using. Titled f

function zi = f(x, y)
q = .6; %transmisiivity of solar glazing
s = 1; %absorptivity of adobe walls
c = 0; %thermal capacitance of the maternity house
d = 4.55; %area of solar collector (m^2)
r = 198.63; %1/Rt
e = 5; %ambient temp.
zi =(((q.*s.*c.*d)-((y-e)/r))./c);

Then we typed into the command window the following string:

>> a = 0;
>> b = 86400;
>> y0 = 20;
>> [x,y]=ode45('f',[a,b],y0)

The values resulted in

x = 0.000000000
0.000000000000

etc

y = NaN
NaN
NaN
etc.

These values are obviously wrong, help please!
You are dividing by c which is set to zero.

CB