% % w02sine_fit.m -- djm -- 12 may 05 % clear; % use a phone # as a random seed seed = 7654321; rand('state',seed); randn('state',seed) % parameters N = 100; phase = rand; noise = 1; x = 2*pi*rand(N,1); x = sort(x); y = sin(x+phase) + noise*randn(N,1); % make a picture figure(1); clf; hold on plot(x,y,'.') plot(x,sin(x+phase),'g--') axis([0 2*pi -1-2*noise +1+2*noise]) title('\bf data for best fit sinusoid')