I am trying to understand these by myself
I want to simulate some straight lines, in Matlab, as follows:
f(t,z)=a(z)t b(z) where a(z) and b(z) are uniformly distributed random variable in the interval [-1,1] and t is time between [-2,2]. More simply: f(t)= at b, and z is the random index of the constant (a,b) and let say [-1, 1] is the sample space for z and z is uniformly distributed.
Could anyone help me with the code? Is there any way to show the random generation of the straight line as an animation? Thank you very much for any help.
I am trying like this:
a= rand(-1,1);
b=rand(-1,1);
-2<t<2;
f=a*t b;
plot(t, f);
But I am getting error Unrecognized function or variable 't'.
CodePudding user response:
Your attempt is not valid MATLAB syntax,