ps7solnsF06

Ps7solnsF06 - %Engineering 6 Fall 2006 Problem 7.1 Solution(Reaction chamber impurity analysis%Suppress extra lines in output and set fixed short

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
%Engineering 6, Fall 2006, Problem 7.1 Solution %(Reaction chamber impurity analysis) %Suppress extra lines in output and set fixed short display format compact ; format short ; clc; %Clear command window clear; %Clear variables %Define impurities vectors impurities1 = [17 18 22 23 19 17 20 21 24 28 20 15 12 18 16]; impurities2 = [21 14 20 19 24 22 16 25 28 27 23 24 11 19 22]; impurities3 = [19 13 22 21 25 19 17 21 27 29 28 21 10 13 18]; %Part (a): How many weeks impurity of chamber 1 < than both 2 and 3 result = (impurities1 < impurities2) & (impurities1 < impurities3); numberOfWeeks = sum(result); disp( 'Number of weeks impurity level of Chamber 1 < Chamber 2 and < Chamber 3:' ); disp(numberOfWeeks); %Part (b): How many weeks impurity of 1 < either 2 or 3 result = (impurities1 < impurities2) | (impurities1 < impurities3); numberOfWeeks = sum(result); disp( 'Number of weeks impurity level of Chamber 1 either < Chamber 2 or < Chamber 3:' ); disp(numberOfWeeks); %Part (c): How many weeks impurity of 1 < 2 or < 3 but not < both result = xor((impurities1 < impurities2), (impurities1 < impurities3)); numberOfWeeks = sum(result); disp( 'Number of weeks impurity level of Chamber 1 < either 2 or 3, but not both:' ); disp(numberOfWeeks); Displayed results: Number of weeks impurity level of Chamber 1 < Chamber 2 and < Chamber 3: 7 Number of weeks impurity level of Chamber 1 either < Chamber 2 or < Chamber 3: 10 Number of weeks impurity level of Chamber 1 < either 2 or 3, but not both: 3
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
%Engineering 6, Fall 2006, Problem 7.2 Solution %Estimation of "pi" using Monte-Carlo simulation dart game %Suppress extra lines in output format compact ; %Clear command window and variables clc; clear; %Simulate 1000, 10,000 and 20,000 dart throws in order to %calculate an estimate for pi. Display results in separate %figure windows. %Simulation 1: 1000 dart throws totaldarts = 1000; %Calculate random x and y coordinates for the dart throws, %where the coordinates are between -1 and 1. Set the random %generator to state 0 to start. rand(
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 01/22/2011 for the course ENG 006 taught by Professor Lagerstrom during the Fall '06 term at UC Davis.

Page1 / 7

Ps7solnsF06 - %Engineering 6 Fall 2006 Problem 7.1 Solution(Reaction chamber impurity analysis%Suppress extra lines in output and set fixed short

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online