Matlab help .. problems in finding integrals

edited June 2006 in Internet & Media
hi all,
i need to find the integral of a complicated function..using int,matlab says it cannot find it..tried using quad but for that i may have to send some parameters to the function..does neone knows how to send parameters when using quad..

as in quad(@myfun,a,b,parameters..)
whr a b are limits..and parameters are some of which i have to send...

ne help???

Comments

  • shwaipshwaip bluffin' with my muffin Icrontian
    edited May 2006
    http://www.mathworks.com/access/helpdesk/help/techdoc/ref/quad.html

    if you want more help, we need more details.
  • edited May 2006
    well..i want to use the quad fn. but apart from sending the function handle and the limits as arguments, i also need to send some more parameters.I dont know if that is allowed and if allowed how to do that??

    shwaip wrote:
    http://www.mathworks.com/access/helpdesk/help/techdoc/ref/quad.html

    if you want more help, we need more details.
  • shwaipshwaip bluffin' with my muffin Icrontian
    edited May 2006
    what other parameters?
  • edited May 2006
    i need to find the integral in the for loop..(means lot of times) and the function computation requires the index values(for loop variables i,j) so i need to pass these values of i and j when i m calling quad...u get my problem??
  • shwaipshwaip bluffin' with my muffin Icrontian
    edited May 2006
    f = @(x)i*j*x;
    Q = quad(f,lowerbound,upperbound);

    if you put both of those inside your for loops, it should do what you'd expect it to. f(x) = i*j*x; F(x) = i*j*x^2/2
  • edited June 2006
    well,first i didnt understant the 2 functions u defined..

    the function i wrote to calculate the quantitiy to be integrated
    it gives me this error,''error in program at line 77,then the line where r was used in an equation ,, Reference to a cleared variable r'',,,r being the variable of integration..this comes even when im running the program for just one value of i and j , can u help with this





    UOTE=shwaip]f = @(x)i*j*x;
    Q = quad(f,lowerbound,upperbound);

    if you put both of those inside your for loops, it should do what you'd expect it to. f(x) = i*j*x; F(x) = i*j*x^2/2[/QUOTE]
  • edited June 2006
    also,one more thing..my function is quite huge,so it wont be possible to define it in 1 line,is it possible to have different functions having the integration variable and then combine them into one??
  • shwaipshwaip bluffin' with my muffin Icrontian
    edited June 2006
    post your code. Enclose it in tags like this:

    [php]
    your code here
    
    [/php]
Sign In or Register to comment.