help-octave
[Top][All Lists]
Advanced

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

Re: Please help


From: Jordi Gutiérrez Hermoso
Subject: Re: Please help
Date: Sun, 28 Aug 2011 13:00:01 -0500

On 28 August 2011 12:49,  <address@hidden> wrote:
> How do I plot this two graphs x=e^0,6667t-1.5 and y_i+1=cos(t^2).

I hope you understand that Octave is not a symbolic calculator, which
you seem to be expecting. To plot in Octave, you actually have to
define all of the points in your plot and then pass all of those
points to the plot command. In particular, you have to specify the
range to plot. The following seems reasonable:

    ## Define 100 points from -2 to 2
    t = linspace(-2, 2, 100);

    ## Define the points for x(t)
    x = exp(0.6667*t) - 1.5;

    ## Define the point for y_i(t)
    y_i = cos(t.^2);

    ## Plot them together
    plot(t,x, t,y)

> I have to find the point of intersection of this two graphs

The easiest way is probably with fsolve:

    ## Define the two functions
    f = @(t) exp(0.6667*t) - 1.5
    g = @(t) cos(t.^2)

    ## Define the function for fsolve
    h = @(t) f(t) - g(t)

    ## Use fsolve to find the zeros of h, with initial guess obtained
    ## from looking at the plot above
    t0 = fsolve(h, 1)

> Sent from my BlackBerry® wireless device
Sent from my Emacs☮ texteditorial device.

HTH,
- Jordi G. H.


reply via email to

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