help-octave
[Top][All Lists]
Advanced

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

Re: solve simultaneous equation (novice)


From: Przemek Klosowski
Subject: Re: solve simultaneous equation (novice)
Date: Tue, 27 May 2014 10:44:55 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0

On 05/25/2014 03:05 PM, message wrote:
Readers,

The function 'fsolve' was attempted to be used to solve the following simultaneous equations:

equation 1: 4.2=2x+4y; equation 2: 6.3=4x+y
Octave is about linear algebra, and these equations can be written in a matrix form (C=A*x) as follows:
[4.2 6.3] = [2 4; 4 1] * x. Now, in Octave you can solve this equation simply as x=C/A. I leave the details out so you can play with them a little to better understand the logical and syntactic requirements of Octave notation.

function y=f(x)
ya=-4.2+2*x+4*4.2/4-2*x/4;
yb=-6.3+4*x+4.2/4-2*x/4;
endfunction
[x,info]=fsolve(@f,[1;2])
Using fsolve for this system is possible but not the natural thing to do.


reply via email to

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