Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- clear all
- format long
- for i=1:1000; %Trial Counter
- rail=1:2400; %each .01 inch segmant of rail
- glove1=unidrnd(2400-409);
- glove2=unidrnd(2400-409); %Picking a spot from 1 to the last element the glove can be on while still covering the rail. I wasn't sure if only a fraction of the glove could hit it or not.
- glove3=unidrnd(2400-409);
- glove4=unidrnd(2400-409);
- for k=1:length(rail);
- if glove1==rail(k);
- rail(glove1:glove1+409)=NaN;
- elseif glove2==rail(k);
- rail(glove2:glove2+409)=NaN;
- elseif glove3==rail(k); %Scans through and sets all values where glove touches rail=NaN
- rail(glove3:glove3+409)=NaN;
- elseif glove4==rail(k);
- rail(glove4:glove4+409)=NaN;
- else
- end
- end
- rail(isnan(rail))=[]; %Deletes touched segments (marked as NaN)
- untouchedspots(i)=length(rail); %Counts untouched elements left of the current trial
- end
- Untouched=mean(untouchedspots)/2400
Add Comment
Please, Sign In to add comment