# Thread: I have been told my answer to this matlab question is wrong

1. ## I have been told my answer to this matlab question is wrong

I have got to create a set of n = 51 points on a grid L(h,x0), characterize by the parameters h = 1 and x0=0, where the second co-ordinate is given by the expression

f(x) =sin(x) + eta*0.1

where -1< eta < 1 is a random deviate (use the function rand to generate such a deviate).

This is what i have done but i have been told it is wrong, have i answered the question?

x = 0:1:50;
eta = 2*rand(size(x))-1;
y = sin(x) + (eta*0.1)

Im not sure if i have done the grid right, i guessed it meant start at 0 and go up 1, 51 times.

2. Originally Posted by adam_leeds
I have got to create a set of n = 51 points on a grid L(h,x0), characterize by the parameters h = 1 and x0=0, where the second co-ordinate is given by the expression

f(x) =sin(x) + eta*0.1

where -1< eta < 1 is a random deviate (use the function rand to generate such a deviate).

This is what i have done but i have been told it is wrong, have i answered the question?

x = 0:1:50;
eta = 2*rand(size(x))-1;
y = sin(x) + (eta*0.1)

Im not sure if i have done the grid right, i guessed it meant start at 0 and go up 1, 51 times.