help-octave
[Top][All Lists]
Advanced

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

Re: solving non-linear set of equations


From: c.
Subject: Re: solving non-linear set of equations
Date: Wed, 28 Sep 2011 15:11:40 +0200

On 28 Sep 2011, at 12:50, Fritz Fischer wrote:

> 
> I read somewhere that I have to create a single file with myfunc. Is this 
> correct? Or is there a way to use this from within the function heat_flux ?

yes, you can write the definition of "myfunc" within the file heat_flux.m like 
this:

function heat_flux(irradiation, temperature)
....
[x, info] = fsolve (@myfun, [10; 10; 10; 10; 10;10])

endfunction

function y = myfun (x)
....
endfunction

> If there is a way to use it from within, is it allowed to call the variables
> like T_sky_kelvin or T_ambient_kelvin ?

If these variables are defined within the body of
the function "heat_flux" the will not be visible within
the scope of the function "myfun"

> If not, how do I pass the functions to myfun if i call is using 
> [x, info] = fsolve ("myfun", [10; 10; 10; 10; 10;10])

You could do it this way:

function heat_flux(irradiation, temperature)

T_ambient_kelvin = 334
T_sky_kelvin = 273

[x, info] = fsolve (@(x) myfun (x, T_ambient_kelvin, T_sky_kelvin), [10; 10; 
10; 10; 10;10])

endfunction

function y = myfun (x, T_ambient_kelvin, T_sky_kelvin)
....
endfunction

> Or am I doing something completly wrong??
> 
> Kind regards,
> Walter

HTH,
c.

reply via email to

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