# Thread: check my errors,i can't run mathlab...

1. ## 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,

2. Originally Posted by ben100
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

3. ## 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?

4. Originally Posted by ben100
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

5. 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.

6. 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.