Results 1 to 3 of 3

Math Help - new to matlab, can anyone guide me plz?

  1. #1
    Newbie
    Joined
    Mar 2009
    Posts
    17

    new to matlab, can anyone guide me plz?

    hey guys just started matlab class, and need guidance through this homeork problem, lets say i ant function f(x)= x^3 range from 0 to 5 how do i put that into matlab. and am i suppose to put the function show next to the graph into matlab?? thanks alot guys
    Attached Thumbnails Attached Thumbnails new to matlab, can anyone guide me plz?-matlab-hw.jpg  
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Member
    Joined
    Apr 2008
    Posts
    191
    Quote Originally Posted by fearless901 View Post
    hey guys just started matlab class, and need guidance through this homeork problem, lets say i ant function f(x)= x^3 range from 0 to 5 how do i put that into matlab. and am i suppose to put the function show next to the graph into matlab?? thanks alot guys

    You can use this code:

    Code:
     
    x=[0:1:5];
    y=x.^3;
    plot(x,y)
    line 1: set x-values
    line 2: here's your equation -- note the .^ operator
    line 3: create the plot

    P.S. the .^ operator means raise each element of the array to the power. In your case the array is from 0 to 5 with step size 1 i.e. [1,2,3,4,5]
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Grand Panjandrum
    Joined
    Nov 2005
    From
    someplace
    Posts
    14,972
    Thanks
    4
    Quote Originally Posted by fearless901 View Post
    hey guys just started matlab class, and need guidance through this homeork problem, lets say i ant function f(x)= x^3 range from 0 to 5 how do i put that into matlab. and am i suppose to put the function show next to the graph into matlab?? thanks alot guys
    Define the function it like this:

    Code:
    f=@(x) x.^3
    or:

    Code:
    f=inline('x.^3')
    then call with:

    Code:
    x=0:0.5:5;
    f(x)
    CB
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Help on Study Guide
    Posted in the Discrete Math Forum
    Replies: 1
    Last Post: June 11th 2011, 11:13 AM
  2. Need help on study guide
    Posted in the Algebra Forum
    Replies: 2
    Last Post: May 3rd 2011, 10:30 AM
  3. Angles guide
    Posted in the Geometry Forum
    Replies: 1
    Last Post: March 25th 2010, 06:39 AM
  4. Algebra guide
    Posted in the Algebra Forum
    Replies: 0
    Last Post: March 24th 2010, 11:30 AM
  5. Study Guide Help
    Posted in the Advanced Statistics Forum
    Replies: 0
    Last Post: December 5th 2008, 10:59 PM

Search Tags


/mathhelpforum @mathhelpforum