Patrick David
2008-03-10 15:46:47 UTC
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
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