Results 1 to 8 of 8

Math Help - function name on graph

  1. #1
    Junior Member
    Joined
    May 2010
    Posts
    39

    function name on graph

    Code:
    x=-10:.1:10;
    y=sin(x);
    plot(x,y);
    How can i display the function name on the graph in mat-lab
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Member
    Joined
    Mar 2007
    Posts
    206
    Awards
    1
    You can use something like:

    Code:
    title sin(x)
    or you can do some nicer things such as:

    Code:
    close all
    x=-10:.1:10;
    y=sin(x/2).^(1/2);
    plot(x,y);
    xlabel x
    ylabel y
    title('$$Sin\left(\frac{x}{2}\right)^{1/2}$$','Interpreter','latex')


    Regards Elbarto
    Attached Thumbnails Attached Thumbnails function name on graph-untitled.jpg  
    Last edited by elbarto; May 27th 2010 at 11:33 PM. Reason: wrong exponent in equation for y
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Junior Member
    Joined
    May 2010
    Posts
    39
    but if i pass the function to a method

    Code:
    function a(f)
    
    title f;
    
    end
    now if i call the above function

    Code:
    a('x+5');
    the title will still be f

    How can i get through this problem?
    Follow Math Help Forum on Facebook and Google+

  4. #4
    Junior Member
    Joined
    May 2010
    Posts
    39
    okay i got it

    you can use title(f);
    Follow Math Help Forum on Facebook and Google+

  5. #5
    Member
    Joined
    Mar 2007
    Posts
    206
    Awards
    1
    Correct. Good work.


    Elbarto
    Follow Math Help Forum on Facebook and Google+

  6. #6
    Junior Member
    Joined
    May 2010
    Posts
    39
    now i need to have the function name displayed close to the actual graph. ( close to the curve) How can i do it.

    Please help.
    Follow Math Help Forum on Facebook and Google+

  7. #7
    Member
    Joined
    Mar 2007
    Posts
    206
    Awards
    1
    Code:
    >>help text
    Much the same as "title" but you provide the position where to place it on the graph.

    Elbarto
    Follow Math Help Forum on Facebook and Google+

  8. #8
    Grand Panjandrum
    Joined
    Nov 2005
    From
    someplace
    Posts
    14,972
    Thanks
    4
    Quote Originally Posted by ilikec View Post
    Code:
    x=-10:.1:10;
    y=sin(x);
    plot(x,y);
    How can i display the function name on the graph in mat-lab
    2-D line plot - MATLAB

    CB
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. How do I graph this sin function?
    Posted in the Trigonometry Forum
    Replies: 1
    Last Post: May 21st 2011, 07:25 PM
  2. Using the graph of the Function
    Posted in the Calculus Forum
    Replies: 1
    Last Post: August 3rd 2010, 10:10 PM
  3. Need help with graph the function
    Posted in the Pre-Calculus Forum
    Replies: 3
    Last Post: November 2nd 2009, 09:48 AM
  4. Replies: 2
    Last Post: August 26th 2009, 05:51 AM
  5. graph function
    Posted in the Pre-Calculus Forum
    Replies: 1
    Last Post: December 1st 2008, 05:12 PM

Search Tags


/mathhelpforum @mathhelpforum