Presentation is loading. Please wait.

Presentation is loading. Please wait.

ENGR-25_Programming-1.ppt 1 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Bruce Mayer, PE Registered Electrical.

Similar presentations


Presentation on theme: "ENGR-25_Programming-1.ppt 1 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Bruce Mayer, PE Registered Electrical."— Presentation transcript:

1 BMayer@ChabotCollege.edu ENGR-25_Programming-1.ppt 1 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Bruce Mayer, PE Registered Electrical & Mechanical Engineer BMayer@ChabotCollege.edu Engr/Math/Physics 25 Prob 5.47, 5.57 Tutorial

2 BMayer@ChabotCollege.edu ENGR-25_Programming-1.ppt 2 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Problem 5.47  Chemical Rcn Order  1 st Order Rate Eqn is Expontnential By SemiLog Linearization we can “Discover” parameters [m & b]  [C(0) & − k  2 nd Order Eqn can be LINEARIZED as Thus ANOTHER Linearizable Fcn

3 BMayer@ChabotCollege.edu ENGR-25_Programming-1.ppt 3 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Prob Solve 1st Step → PLOT it  Advice for Every Engineer and Applied Mathematician or Physicist: RRule-1: When in Doubt PLOT IT! RRule-2: If you don’t KNOW when to DOUBT, then PLOT EVERYTHING

4 BMayer@ChabotCollege.edu ENGR-25_Programming-1.ppt 4 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Prob 5.47  When in Doubt PLOT  Some CURVATURE  Straight Better Model t  X 1/C  Y

5 BMayer@ChabotCollege.edu ENGR-25_Programming-1.ppt 5 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Linear Xform of 2 nd Order Reaction  Now that the plot has identified the Rcn as 2 nd Order, Make Linear Xform  The 2 nd Order Eqn  Use polyfit of order-1 to generate fitting parameters contained in vector k_1overC0  That is: k_1overC0 = [m, B 2 ]; or k_1overC0(1) = m = k k_1overC0(2) = B 2 = 1/C(0)

6 BMayer@ChabotCollege.edu ENGR-25_Programming-1.ppt 6 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods The 2 nd Order Model

7 BMayer@ChabotCollege.edu ENGR-25_Programming-1.ppt 7 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods P 5.47 Answer  k_1overC0 = [m B 2 ] = [k 1/C0] = [5.4445e-001 9.9605e+001]  k = 5.4445e-001 k = 0.54445  C0 = 1/9.9605e+001  1.0040e-002 C = 0.01004

8 BMayer@ChabotCollege.edu ENGR-25_Programming-1.ppt 8 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods P5.57 Geometry  E-Field Governing Equation

9 BMayer@ChabotCollege.edu ENGR-25_Programming-1.ppt 9 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods The Distance Calcs  Using Pythagorean Theorem

10 BMayer@ChabotCollege.edu ENGR-25_Programming-1.ppt 10 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods The MeshGrid Plot % Bruce Mayer, PE * 04Nov06 % ENGR25 % file = Prob5_57_Point_Charges_meshgrid_Plot_0611.m % Surface Plot eField from two Point Charges % % CLEAR out any previous runs clear % The Constant Parameters q1 = 2e-10; q2 = 4e-10; % in Coulombs epsilon = 8.854e-12; % in Farad/m % % Note the distances, r1 & r2, to any point(x,y) in the field by pythagorus % * r1 = sqrt((x-0.3)^2 + y^2) % * r2 = sqrt((x+0.3)^2 + y^2) % % Construct a 25x25 mesh [X Y] = meshgrid(-0.25:0.010:0.25); % % find r1 & r2 by pythagorus and array-ops r1 = sqrt((X-0.3).^2 +Y.^2); % note dots used with array operation r2 = sqrt((X-(-0.3)).^2 +Y.^2); % note dots used with array operation % use vectors r1 & r2, and array ops to find V V = (1/(4*pi*epsilon))*(q1./r1 + q2./r2); % % use %-Comment to toggle between SURF & MESHC plots % surf(X,Y,V), xlabel('X-distance'), ylabel('Y-distance'),... zlabel('Elect. Potential (V)'), title('2 Point-Charges Electical Field'),... grid on meshc(X,Y,V),, xlabel('X-distance'), ylabel('Y-distance'),... zlabel('Elect. Potential (V)'), title('2 Point-Charges Electical Field'),... grid on

11 BMayer@ChabotCollege.edu ENGR-25_Programming-1.ppt 11 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Meshc Plot MeshGrid

12 BMayer@ChabotCollege.edu ENGR-25_Programming-1.ppt 12 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods surf Plot by MeshGrid

13 BMayer@ChabotCollege.edu ENGR-25_Programming-1.ppt 13 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods The Loop Plot % Bruce Mayer, PE * 04Nov06 * ENGR25 % file = Prob5_57_Point_Charges_Loop_Plot_0611.m % Surface Plot eField from two Point Charges Clear % CLEAR out any previous runs % The Constant Parameters q1 = 2e-10; q2 = 4e-10; % in Coulombs epsilon = 8.854e-12; % in Farad/m % Note the distances, r1 & r2, to any point(x,y) in the field by pythagorus % * r1 = sqrt((x-0.3)^2 + y^2) % * r2 = sqrt((x+0.3)^2 + y^2) % Build up From Square XY Plane % r1 goes to q1 at (0.3,0) % r2 goes to q2 at (-0.3,0) x = linspace(-.25,.25, 50); %50 pts over x-range y = linspace(-.25,.25, 50); %50 pts over y-range for k = 1:length(x) for m = 1:length(y) % calc r1 & r2 using pythagorus r1 = sqrt((x(k)-0.3)^2 + y(m)^2); r2 = sqrt((x(k)-(-0.3))^2 + y(m)^2); % Find V based on r1 and r1 V(k,m) = (1/(4*pi*epsilon))*(q1/r1 +q2/r2); % Note that V is a 2D array using the x & y indices end end X = x; Y = y; % use %-Comment to toggle between SURF & MESHC plots surf(X,Y,V), xlabel('X-distance'), ylabel('Y-distance'),... zlabel('Elect. Potential (V)'), title('2 Point-Charges Electical Field'),... grid on %meshc(X,Y,V),, xlabel('X-distance'), ylabel('Y-distance'),... zlabel('Elect. Potential (V)'), title('2 Point-Charges Electical Field'),... grid on

14 BMayer@ChabotCollege.edu ENGR-25_Programming-1.ppt 14 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods meshc Plot by Loop Note that plot is TURNED

15 BMayer@ChabotCollege.edu ENGR-25_Programming-1.ppt 15 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods surf Plot by Loop Note that plot is TURNED


Download ppt "ENGR-25_Programming-1.ppt 1 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Bruce Mayer, PE Registered Electrical."

Similar presentations


Ads by Google