Results 1 to 6 of 6

Math Help - check my errors,i can't run mathlab...

  1. #1
    Newbie
    Joined
    Mar 2010
    Posts
    7

    check my errors,i can't run mathlab...

    Generate an image I with x and y both varying from -10 to 10 with step-size dx and dy both as 0.2, and scale the intensity value of the image to [0, 255];

    theta = pi/6
    dx = 0.2
    dy = 0.2
    x=-10
    y=-10
    a=0.4

    mat = zeros(100) %create 100 by 100 matrix. y? -10 to 10 is 20.. and increment by 0.2 so -10, -9.8, -9.6 ... 9.6, 9.8, 10 has 100 in total.

    for i=0:100
    for j=0:100
    mat(i,j)=partBhelper (x,y, theta,a)
    increment x by dx;(how?)
    end
    reset x to -10 (how?)
    increment y by dy(how?)
    end
    display the matrix but scale it to 0 to 255 (hint. imshow())
    end

    see my underlined answer,because i'm not sure and do not know how to make it in the source code.
    thank you,
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Grand Panjandrum
    Joined
    Nov 2005
    From
    someplace
    Posts
    14,972
    Thanks
    4
    Quote Originally Posted by ben100 View Post
    Generate an image I with x and y both varying from -10 to 10 with step-size dx and dy both as 0.2, and scale the intensity value of the image to [0, 255];

    theta = pi/6
    dx = 0.2
    dy = 0.2
    x=-10
    y=-10
    a=0.4

    mat = zeros(100) %create 100 by 100 matrix. y? -10 to 10 is 20.. and increment by 0.2 so -10, -9.8, -9.6 ... 9.6, 9.8, 10 has 100 in total.

    for i=0:100
    for j=0:100
    mat(i,j)=partBhelper (x,y, theta,a)
    increment x by dx;(how?)
    end
    reset x to -10 (how?)
    increment y by dy(how?)
    end
    display the matrix but scale it to 0 to 255 (hint. imshow())
    end

    see my underlined answer,because i'm not sure and do not know how to make it in the source code.
    thank you,
    Something like:

    Code:
    -->                                                                        
    --> x=linspace(-10,10,101);                                                
    --> y=linspace(-10,10,101);                                                
    -->                                                                        
    --> [X,Y]=meshgrid(x,y);                                                   
    -->                                                                        
    --> Z=rand(size(X))*255;                                                   
    -->                                                                        
    --> image(X,Y,Z);                                                          
    -->
    CB
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Newbie
    Joined
    Mar 2010
    Posts
    7

    there is one part mathlab can run

    mathlab could not run mat(i,j)=partBhelper (x,y, theta,a),

    what is the mistakes?

    function name: partb
    function return: (returns nothing)
    function parameters: (nothing
    )


    theta = pi/6
    dx = 0.2
    dy = 0.2
    x=-10
    y=-10
    a=0.4

    the underlined answer mathlab could not run because of unexpected MATLAB operator,
    why?
    Follow Math Help Forum on Facebook and Google+

  4. #4
    Grand Panjandrum
    Joined
    Nov 2005
    From
    someplace
    Posts
    14,972
    Thanks
    4
    Quote Originally Posted by ben100 View Post
    mathlab could not run mat(i,j)=partBhelper (x,y, theta,a),

    what is the mistakes?

    function name: partb
    function return: (returns nothing)
    function parameters: (nothing
    )


    theta = pi/6
    dx = 0.2
    dy = 0.2
    x=-10
    y=-10
    a=0.4

    the underlined answer mathlab could not run because of unexpected MATLAB operator,
    why?
    Without you providing more information we can't say. Have you considered running the debugger?

    How is this related to the original question?

    What is partBhelper? Is it on the Matlab path?

    CB
    Follow Math Help Forum on Facebook and Google+

  5. #5
    Newbie
    Joined
    Mar 2010
    Posts
    7
    The question is same as i had posted before.Is the partb() same with partbhelper?
    is the function are needed to put at the first of the code.as i know we do not write

    mathlab could not run mat(i,j)=partBhelper (x,y, theta,a),infinite loop always occur,is there any other equation to replace mat(i,j)=partBhelper (x,y, theta,a).

    Thank you.
    Follow Math Help Forum on Facebook and Google+

  6. #6
    Newbie
    Joined
    Mar 2010
    Posts
    7
    The question is same as i had posted before.Is the partb() same with partbhelper?
    is the function are needed to put at the first of the code.as i know we do not write

    mat(i,j)=partBhelper (x,y, theta,a),infinite loop always occur,is there any other equation to replace mat(i,j)=partBhelper (x,y, theta,a).

    Thank you.
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. mathlab- root finding
    Posted in the Math Software Forum
    Replies: 1
    Last Post: October 16th 2009, 05:17 PM
  2. Transcendental Equation-Mathlab
    Posted in the Advanced Math Topics Forum
    Replies: 1
    Last Post: May 20th 2009, 01:23 AM
  3. Mathlab code
    Posted in the Math Software Forum
    Replies: 1
    Last Post: March 26th 2009, 04:56 AM
  4. Mathlab help Bisection Method
    Posted in the Math Software Forum
    Replies: 4
    Last Post: June 16th 2008, 06:05 AM
  5. Mathlab integral(area)
    Posted in the Math Software Forum
    Replies: 6
    Last Post: May 4th 2008, 07:28 AM

Search Tags


/mathhelpforum @mathhelpforum