help-octave
[Top][All Lists]
Advanced

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

to solve nonlinear equation


From: Shiro TAKEDA
Subject: to solve nonlinear equation
Date: 17 Apr 2000 08:14:53 +0900
User-agent: Semi-gnus/6.10.12 SEMI/1.12.1 ([JR] Nonoichi) FLIM/1.12.7 (YĆ«zaki) Emacs/20.5 (i386-debian-linux-gnu) MULE/4.0 (HANANOEN)

Hello.  I am a beginner of Octave.

I want to do the very simple thing by Octave, but I don't
know how because I don't yet know much about programming in
Octave.

What I want to do is that (i) solve nonlinear equations and
(ii) plot the solution as a fuction of a exogenous
parameter.

Let me take an example.

I have equations like

x(2) - exp (-x(1)) = 0
x(1) - x(2)^3 - t = 0

If I determine the value of a parameter `t' (for example
t=1), I can solve these equations.

First,

function y = test (x)
t = 1;
y(1) = x(2) - exp (-x(1))
y(2) = x(1) - x(2)^3 - t
endfunction

and then run `fsolve'
   
[x, info] = fsolve ("test", [0; 0])

I get the solutions (x(1),x(2)):

x =

  1.04367
  0.35216

info = 1

If I give another value of `t', I get another value of x(1)
by the same procedure.  Continuing this procedure, I can get
various values of x(1) corresponding to various values of
parameter `t'.  But it is hard to do this manually.

So, I want to make a program to do this automatically, that
is, a program to chage the value of a parameter `t'
continuously, and plot x(1) as a function of `t'.

I tried to read Octave manual, but it is a little difficult
for me to understand.

Can someone please tell me how to do?

Thanks in advance.

-- 

Shiro TAKEDA




-----------------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.che.wisc.edu/octave/octave.html
How to fund new projects:  http://www.che.wisc.edu/octave/funding.html
Subscription information:  http://www.che.wisc.edu/octave/archive.html
-----------------------------------------------------------------------



reply via email to

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