My code isnt working for some reason and I cant seem to figu
My code isn\'t working for some reason and I can\'t seem to figure out why. (I am using Matlab)
syms n k ;
k = 4:26;
n = power(2,k);
clear
x=rand(n,1)<0.5 ;
mean(x)
error = abs(mean(x)-0.5);
plot(n,error);
I want to plot the various values of error vs the number of flips (n).
Solution
Since you have put clear in your code, it will not remember the variable n.
Try removing clear and run the code
