[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
solve simultaneous equation (novice)
From: |
message |
Subject: |
solve simultaneous equation (novice) |
Date: |
Sun, 25 May 2014 19:05:36 +0000 |
User-agent: |
Roundcube Webmail/1.0.0 |
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
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])
warning: f: some elements in list of return values are undefined
warning: f: some elements in list of return values are undefined
warning: f: some elements in list of return values are undefined
warning: f: some elements in list of return values are undefined
warning: f: some elements in list of return values are undefined
warning: f: some elements in list of return values are undefined
x =
1
2
info = [](0x0)
Manual solution:
Rearrangement to
4y=4.2-2x, 4.2/4-2x/4
6.3=4x+4.2/4-2x/4 -> 25.2=16x+4.2-2x -> 25.2-4.2=16x-2x -> 21=14x ->
x=3/2
4.2=2*3/2+4y -> 4.2=3+4y -> 1.2=4y -> 1.2/4=y -> y=.3
Please what is my error in octave syntax to prevent the same result in
octave as in the manual method described?
- solve simultaneous equation (novice),
message <=