I have the following code from mathematica and trying to do it with matlab but I can't do it:
tX := Sum[Random[] - 0.5, {m}]/m
m=1;
km=10m;
dataX = Table[tX, {km}]
fig2 = ListPlot[dataX, PlotStyle -> {RGBColor[1, 0, 0], PointSize[0.015]}]
I did this :
tx=sum(rand(1,m)-0.5) ./ m;
m=100;
km=100*m;
datax=zeros(tx,1);
for i=1:km
datax(i,1)=[tx];
end
I have two problems:
- In mathematica the tx := means that the variable tx is evaluated each time it is used. How can I accomplish this in matlab?
- I have some mistake or mistakes in my code because when it gives me the plot it gives me a straight line but it should give a big number of points.