Minyu Chen wrote:
Dear all:
I am sorry that the question might sound a bit silly.
I need to solve a function involving integration, so I think I
need both quad()--for the integration and fsolve()--for the
equation. However, the integrand involve the unknown.
For a trivial example, I want to solve: x+\int_{0}^{1}x*y dy=0
I was thinking of taking a function:
function w=f(y)
w=x.*y;
on this line what 'x' do you expect to have? you need to pass your
x in from g() to f() if that is the x you though tit would be.
endfunction
Then I use another function:
function z=g(x)
z=quad('f',0,1)+x;
endfunction
Then I use: fsolve('g',0.5). But it didn't work.
The error message is that the "x" is not defined in my f
function. However, I called "f" only in the function "g", and the
x in the function "g" is already initialized as 0.5 in the
searching. What went wrong?
Thank you very much.
Thanks,
Minyu Chen
_______________________________________________
Help-octave mailing list
address@hidden
https://www.cae.wisc.edu/mailman/listinfo/help-octave
--
David Grohmann
Senior Student Associate
Applied Research Lab : UT Austin : ESL - S206
Office: 512-835-3237