help-octave
[Top][All Lists]
Advanced

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

Re: defining a function from 2 other ones


From: Rupert Swarbrick
Subject: Re: defining a function from 2 other ones
Date: Thu, 16 Aug 2007 18:14:37 +0100

On Thu, 16 Aug 2007 19:04:45 +0200
address@hidden wrote:

> Hi,
> I want to summe 2 functions and create a 3dr one.
> Is it possible?
> 
> Example:
> f=@(x,p)  p*x
> g=@(x,k) x.^k
> h=@(x,p,k) f + g
> 
I think you want to replace your 3rd line by

h = @(x,p,k) f(x,p) + g(x,k)

Thinking about it, how else would octave know which arguments went to
which function?

Rupert

Attachment: signature.asc
Description: PGP signature


reply via email to

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