help-octave
[Top][All Lists]
Advanced

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

one-dimensional integration over two-dimensional function


From: Patrick David
Subject: one-dimensional integration over two-dimensional function
Date: Mon, 10 Mar 2008 17:26:31 +0100 (CET)

Hello out there,

I used MATLAB a few times but I am still beginner. Here is my problem:

function retval = foo(x,y)
  retval = x + y;
endfunction

I want to calculate the integration of foo in the limits from x=3 to x=5,
y shall be konstant (lets say y=10)!

quad("foo(x,10)", 3, 5)    --> works
quad(@(x) foo(x,10), 3, 5  --> works too
n = 10
quad("foo(x,n)", 3, 5)    --> doesn't work
quad(@(x) foo(x,n), 3, 5  --> doesn't work too

I am sure the problem is really simple, but I try for about two hours. How
can I define the integral without writing the number 10 directly in the
line (I want to use it in a script, so I have to use a variable)

Thanks for your help
Greetings
Patrick




reply via email to

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