help-octave
[Top][All Lists]
Advanced

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

Re: Parametric system solve -> parametric plot


From: Ivan Sutoris
Subject: Re: Parametric system solve -> parametric plot
Date: Sun, 1 Mar 2009 05:38:52 -0800 (PST)


Bertone wrote:
> 
> Hello to everybody,
> I'm a physicist and an Octave-proud newbie, I need technical help to solve
> a simple problem.
> 
> I've got a parametric nonlinear system of 2 eqns in 2 unknowns plus a
> parameter, t:
> 
> f(x,y,t) = 0  AND g(x,y,t) = 0
> 
> well,
> 
> I could solve it point-by-point by setting manually a value for t and
> obtaining a point (x(t),y(t)), then following the instructions contained
> in the User Manual. 
> 
> What should I tell Octave to draw a plot of the curve x(t), y(t) which is
> implicitly defined by the system above? 
> 
> Thank you all!
> 
> Mario Alberto
> 

Hi

if you have already solved your system for various values of t and have the
results in vector x and y, you can just use plot(x,y). Assuming you have
functions f and g already defined, it could look like this (not tested):

t = 0:0.01:1; % or whatever you need
x = zeros(length(t), 1);
y = zeros(length(t), 1);
for i=1:length(t)
    solfun = @(X) [f(X(1), X(2), t(i)); g(X(1), X(2), t(i))];
    X0 = [1; 1];
    X = fsolve(solfun, X0);
    x(i) = X(1);
    y(i) = X(2);
end
plot(x,y)

BTW, I did not receive your email through regular mailing list (just noticed
it on Nabble), so there may have been some problem with your email passing
through.

Regards
Ivan Sutoris
    

-- 
View this message in context: 
http://www.nabble.com/Parametric-system-solve--%3E-parametric-plot-tp22266911p22273020.html
Sent from the Octave - General mailing list archive at Nabble.com.



reply via email to

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