Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Matlab m file function with multiple variables

  1. Oct 10, 2011 #1

    I have a matlab function m file and I want to integrate the function.

    Code (Text):
    function y = myfun(t,a,b)

    y = (1/(2*pi)).*(1./t)*(1i*(a+b));

    Then when I call the integration in matlab I dont know how to specify a and b whilst integrating over t.

    I need to be able to set a and b outside of the function m file and then call the integral.

    This command will not work. a and b need to be set. I want to set a and b (this can vary) and then run the integral. I have tried set a and b in the matlab workspace but that still doesnt work.

    Please can anyone help?
    ** Also, please let me know if my explanation is not clear?

    Last edited: Oct 10, 2011
  2. jcsd
  3. Oct 10, 2011 #2
    Solved it.

    Its how you call the function.

    It should be:


  4. Oct 24, 2011 #3
    hi to all
    I have a problem with timer in gui in matlab
    i wanna to show real time in gui figure but when run the timer mfile it create a new figure
    seperatly from main figure

    any one can help me?
    if know a way for this problem please help me ....
    my email address is : mhmz66@yahoo.com
    tnx so mucho:)
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook