You are on page 1of 120
Instructor’s Manual ENGINEERING PROBLEM SOLVING ® wirn MATLAB Delores M. Etter Prentice Hall, Upper Saddle River, NJ 07458 Publisher: Alan Apt Production Editor: Mindy De Palma ‘Supplement Cover Designer: Marianne Frasco Special Projects Manager: Barbara A. Murray ‘Supplement Cover Manager: Paul Gourhan ‘Manufacturing Buyer: Donna Sullivan Editorial Assistant: Kate Kaibni © 1998 by Prentice-Hall, Inc. ‘A Pearson Education Company Upper Saddle River, NJ 07458 All rights reserved. No part of this book may be reproduced, in any form or by any means, without permission in writing from the publisher Printed in the United States of America 9876543 ISBN O-13-517039-7 Prentice-Hall International (UK) Limited,London Prentice-Hall of Australia Pty. Limited, Sydney Prentice-Hall Canada Inc,, Toronto Prentice-Hall Hispanoamericana, S.A., Mexico Prentice-Hall of India Private Limited, New Delhi Prentice-Hall of Japan, Inc., Tokyo Pearson Education Asia Pte. Ltd., Singapore Faditora Prentice-Hall do Brasil, Ltda., Rio de Janeiro Contents Page Preface iv Solutions to End-of -Chapter Problems Chapter 2 1 Chapter 3 4 Chapter 4 8 Chapter 5 12 Chapter 6 19 Chapter 7 28 Chapter 8 32 Chapter 9 2 Chapter 10 B Chapter 11 59 ‘Transparency Masters 67 Preface This Instructor's Manual contains solutions to all the end-of-chapter problems in the Second Edition of Engineering Problem Solving with MATLAB. In addition, a set of 50 ‘transparency masters are also included. The contents of these transparency masters, chosen from figures and diagrams from the text, are listed below: Internal organization of a computer Software interface to the computer Comparison of software statements Program compilation/linking/execution Software life-cycle phases Numeric display formats Simple plot Enhanced plot Arithmetic operations between two scalars Precedence of arithmetic operations Element-by-element operations Line and mark options Random sequences Histograms with 25 bins Relational operators Logical Combinations of logical operators Linear and cubic spline interpolation Linear estimate Best-fit estimate Polynomial fits Integral of f(x) from a to b Derivative of f(x) at x=a Example of function with critical points Techniques for computing f(x,) All of the programs have been computer tested, but some errors always manage to slip through, both in the text and in the Instructor's Manual. I would appreciate it very much if you would share with me any errors that you find so that they can be comrected when the text or this Instructor's Manual are reprinted. Text errors will also be included on my WWW page at http://ece-www colorado.edu/faculty/etter.html. Professor Delores M. Etter Electrical/Computer Engr. Dept. Campus Box 425 University of Colorado Boulder, CO 80309-0425 etter@boulder.colorado.edu iv Engineering Problem Solving with MATLAB, Second Edition by Delores M. Etter Chapter 2 2.1% ‘This program generates a table of conversions % from degrees to radians. & deg = 0:10:360; xad = deg*pi/180; pL) = deg’; 2,2) = rad’; Gisp(‘Angle Conversion’ ) Gisp(‘Degrees and Radians*) disp(table) 2.2 % This program generates a table of conversions % from centimeters to inches. * em = 0:2:50; inches = cm/2.54; disp (‘Unit Conversion’) disp( ‘Centimeters and Inches") disp(table) 2.3% This program generates a table of conversions % from mi/hr to ft/s. mi_hr = 0:5:65; ft_s = mi_hr*5280/3600; & disp('Unit Conversion’) disp(‘mi/hr and ft/s") disp(table) 2.4 % This program generates a table of conversions % from francs to dollars. & francs = 5:5:25%5; dollars = francs/5.045; ® table(:,1) = francs’; table(:,2) = dollars'; & disp( ‘Currency Conversion’) disp(‘Francs and Dollars’) disp(table) Engineering Problem Solving with MATLAB, Second Edition by Delores M. Etter 2.5 % This program generates a table of conversions %& from deutsche marks to francs. 8 marks 2430; dollars = marks/1.4682; francs = dollars*5.045; & table(:,1) = marks"; table(:,2) = francs’; & disp( ‘Currency Conversion’) disp( ‘Deutsche Marks and Francs’) disp(table) 2.6 % This program generates a table of conversions % from yen to deutsche marks. & yen = 100:9900/24:10000; @ollars = yen*0.0101239; marks = dollars*1.4682; ® table(:,1) = yen'; table(:,2) = marks"; ® disp( ‘Currency Conversion’) disp('Yen and Deutsche Marks') disp(table) 2.7% ‘This program generates a table of conversions % from dollars to francs, deutsche marks and yen. 50; dollars*5.045; dollars*1. 4682, dollars/0.010123: +1) = dollars: 12) = francs"; 13) = marks"; table(:,4) = yen’; ® isp( ‘Currency Conversion’) disp('Dollars, Francs, Deutsche Marks, Yen") disp(table) Engineering Problem Solving with MATLAB, Second Edition by Delores M. Etter 2.8 2.9 2.10 % This program generates a table of conversions % from Fahrenheit to Kelvin. inc = input('Enter the increment between lines in Fahrenheit: ' fabr = 0:ine:200; celcius = (5*(fahr - 32))/9; & table(:,1) = fahr'; table(:,2) = celcius'; 8 disp( Temperature Conversion’) disp('Fahrenheit to Celcius’) disp(table) & ‘This program generates a table of conversions & from Celcius to Rankin. & strt = input('Enter the starting temperature in Celcius inc = input('Enter the increment between lines in Celcius: '); a celcius = strt:inc:strt+inc*24; fahr = (9*celcius) /5 + 32; vankin = fahr + 459.67; & table(:,1) table(:,2) s disp( ‘Temperature Conversion’) disp( ‘Celcius to Rankin’) disp(table) % ‘This program generates a table of conversions % from Celcius to Fahrenheit. input (‘Enter the starting temperature in Celcius: input ("Enter the increment between lines in Celcius = input (‘Enter the number of lines in the table: '); table(:,1) table(:,2) & disp(' Temperature Conversion’) disp( ‘Celcius to Fahrenheit') disp(table) celcius'; fahe'; Engineering Problem Solving with MATLAB, Second Edition by Delores M. Etter Chapter 3 3.1 & ‘This program computes a rocket trajectory. s & = 0:2:100; height = 60 + 2.13*t.*2 - 0.0013%t.*4 + 0.000034*t.*4.751; & k = find(height <= 0); if length(k) == 0 ground = 100; else ground = k(1) - 1; a disp('Time and Height") table(:,1) = t(1:ground) ' table(:,2) = height (1:ground) ' disp (table) 3.2 % This program computes a rocket trajectory. % t = 0:2:100; height = 60 + 2.13*t.*2 ~ 0,0013*t.*4 + 0.000034%t.*4.751; % N = length height difference = height (2:N) - height (1:0-1); k fall = find(difterence < 0); KLimpact = find(height <= 0); * if length(k fall) > 0 fprint£ ("Rocket begins falling at %5.0f s \n',t(k_fa11(1))) else fprint£ (‘Rocket does not begin falling in 100 s \n') end. if length(k impact) > 0 fprint£ ("Rocket impacts at %5.0£ s \n',t(k impact (1))) else fprintf£ (‘Rocket does not impact in 100 s \n') % ‘This program prints a quality control report. 3 batch = [24551 24582 26553 26623 26642]'; temp = (145.5 153.7 160.3 159.5 160.31"; pressure = (62.3 63.2 58.9 58.9 61.2]'; dwell = [2.23 2.52 2.51 2.01 1.98)"; WN = length (batch) ; s temp_err = length(find(temp>170 | temp<150)); pressure_err = length(find(pressure>70 | pressure<60)); well_err = length(find(dwell>2.5 | dwell<2.0)); & fprint£ (‘Temperature errors: %6.2£ percent \n', temp_err/N*100) fprint£ (‘Pressure errors: %6.2£ percent \n' ,pressure_err/N*100) fprint£ (‘Dwell errors: %6.2£ percent \n',dwell_err/N*100) Engineering Problem Solving with MATLAB, Second Edition by Delores M. Etter 3.4% This program prints a quality control report. & batch = [24551 24582 26553 26623 26642)"; temp = [145.5 153.7 160.3 159.5 160.31"; pressure = (62.3 63.2 58.9 58.9 61.2]'; @well = [2.23 2.52 2.51 2.01 1.98]'; N= length(batch) ; ¢ temp_err = length(find(temp>170 | temp<150)); pressure_err = length(£ind(pressure>70 | pressure<60) ); dwell_err = length(find(dwell>2.5 | dwell<2.0)); 4 fprint£ (‘Temperature errors: $6.2f percent \n‘, temp_err/N*100) fprint£ (‘Pressure errors: $6.2f percent \n',pressure_err/N*100) fprint£ (‘Dwell errors: 86.2f percent \n' ,dwell_err/N*100) & fprint£ (‘Temperature errors: 6.0f \n', temp_err) fprint£ (‘Pressure errors: %6.0f \n' ,pressure_err) fprint£ (‘Dwell errors: 6.0£ \n' ,dvell_err) fprint£ (‘Total Number of Batches’ with Errors %6.0f \n‘,N) 3.5 % This program prints a quality control report. & oad suture.dat pressure = dwell = suture(:, 4); N = length (batch) ; & good = find(150 10); sensor (indexl) = 10*ones (size(index1)); index? = find(sensor < -10); sensor (index2) = -10*ones(size(index2)); 8 save sensor.dat sensor -ascii % ‘This program analyzes sensor data. a load sensor. dat & fprint£ (‘Subscripts with absolute value greater than 20: \n‘) [x,y] = £ind(sensor > abs(20)) Engineering Problem Solving with MATLAB, Second Edition by Delores M. Etter 3.12 3.14 3.15 % This program analyzes sensor data. & load sensor.dat (xsize,y_size] = size(sensor); num_tot'= x sizety_size; & %& Note use of find to return matrix subscripts. & [xAoc,y_loc] = find(sensor pum_zeros = length(x loc); fprintf (‘Percentage of sensor data equal to zero: #5.0£ \n',.. 100%num_zeros/num_tot) Ds & ‘This program analyzes power plant data. & load plant.dat [nweeks ndays] = size(plant); & %& Note use of find to return matrix subscripts. & average = mean(plant(:)); [week,day] = find(plant > average); & fprint£ (‘Power Average = %6.2£ \n', average) fprinté (‘Week and day for above-average power output: \n') disp( [week day]) % ‘his program analyzes power plant data. & load plant.dat e % Note use of find to return matrix subscripts. ® [week,day] = find(plant == max(plant(:))); fprintf (‘Week and day of maximum power output: \n') disp( [week day]) & [week,day] = find(plant == min(plant(:))); fprintf (‘Week and day of minimum power output: \n') disp( [week day]) % ‘This program analyzes power plant data. & load plant.dat [nweeks ndays] = size(plant); ® day_ave = mean(plant) ; week ave = mean(plant') ; & fprinté (‘Daily Averages: \n') disp({(1:ndays) ' day_ave']) fprinté (‘Weekly Averages: \n') isp([(1:nweeks)' week_ave']) Problem Solving with MATLAB, Second Edition by Delores M Br Chapter 4 4a 4.2 43 % This program computes molecular weights. s oxygen = input (‘Input the number of oxygen molecules: carbon = input (‘Input the number of carbon molecules: nitrogen = input (‘Input the munber of nitrogen molecule: sulfur = input (‘Input the number of sulfur molecules: '); hydrogen = input ("Input the nunber of hydrogen molecules: a weights = [15.9994 12.011 14.00674 32.066 1.00794); nummolecules = [oxygen carbon nitrogen sulfur hydrogen); mol_weight = dot (weights, num molecules) ; & fprint£(' Molecular weight is: $3.3f \n',mol_weight) & This program computes amino acid molecular weights. oad elements. dat weights = [15.9994 12.011 14.00674 32.066 1.00794)"; acid wee = elements*weights; Save weights. dat acid.wes /ascii % This program computes amino acid molecular weights. Jona etenents.ant feichts = [15.9994 12.011 14.00674 32.066 1.007941"; feld.nts = elenmnts*veights; fprintf (‘Average amino acid weight: $9.3£ \n',mean(acid_wts)) a save weights.dat acid wts /ascii & ‘This program computes amino acid molecular weights. s load elements.dat & weights = [15.9994 12.011 14.00674 32.066 1.00794)"; s acidwts = elements*weights; % fprinté (‘Average amino acid weight: %9.3£ \n',mean(acid_wts)) fprinté (‘Minimum amino acid weight: $9.3£ \n',min(acid_wsts)) fprint£ (‘Minimum amino acid weight: $9.3£ \n',max(acid_wsts)) ® save weights.dat acid wts /ascii 46 47 4.8 4.9 function y = minor (A,m,n) % MINOR This function computes the minor of element A(m,n). a x= Ar [nrows,ncols] = size(x); if m~* nrows x(m:nrows-1, end ifn x( end 8 = x(1:nrows-1,1:ncols-1) ; y = det is) = x(m+L:nrows, neols n:ncols-1) = x(:,ntL:ncols); function y = cofactor (A,m,n) % COFACTOR This function computes the (m,n) cofactor of a matrix. g y = (-1)* (min) ‘minor (A,m,n) ; function y = determinant_r(A,col) % DETERMINANT_R This function computes the determinant of a & matrix using a colum and its cofactors a [nrows,ncols] = size(A); y for rows y = y + A(k,col) *cofactor(A,k, col); end function y = determinant_c(A, row) % DETERMINANT_C This function computes determinant of a g matrix using a row and its cofactors. a [nrows,ncols] = size(A); y :ncols Y + A(zow,k) *cofactor (A, row,k) ; function y = dmatrix(a) % DLMATRIX This function determines if a matrix is diagonal and s returns a 1 if it is and a 0 otherwise. s mask = ones(size(A)) - eye(size(A)); if sum(sum(abs(A.*mask))) == 0 yel: else y end Engineering Problem Solving with MATLAB, Second Edition by Delores M. Etter 4.10 4.1 4.13 function y = ut_matrix(A) & UTLMATRIX This function determines if a matrix is upper s triangular and returns 1 if it is and 0 otherwise. & mask = tril(ones(size(A)),-1) if sum(sum(abs (A. *mask)}) =: yel else ee end function y = 1t_matrix(a) % LT MMIRIX This function determines if a matrix is lower 8 triangular and returns 1 if it is and 0 otherwise. a y = ut matrix(A'); function y = p_ut_matrix(A) % PLUTMATRIX This function returns 1 if a matrix is a permuted upper triangular and returns 0 otherwise. Iz,c] = size(a); Find number of leading zeros for each row. = Find (a(n, +) if Length (k) index (n) else index(n) = k(1) - 1; end end List = sort (index); 8 0); % Find non-zeros. % Compute leading zeros. % Compute minimum leading zeros for permuted matrix 8 min % I£ less than minimum leading zeros, then not permuted. & Af length(£ind(min_zeros <= list)) 1 for k-1:length (index) tally (index(i)) = 0; end end end fprint£('%5.0f equations for distinct hyperplanes: \n‘,... Length(find(tally == 1))) for kel:nrows = coef (ik, 2) 5 if tally(k) == 1 disp (eqns (ik, :)) end end % This program solves a system of linear equations. & As (1,1,2,1; 2,-2,0,2; 3,1,-2,-1; 1,-2,-3,21; Be (4,2,2,-315; s XL = inv(a)*B 32 = BY*inv(a') Output values: XL! = x2 = [1111] 16 Engineering Problem Solving with MATLAB, Second Edition by Delores M. Etter 5.10 % This program solves a system of linear equations. & As (2,3,1,2; 2,-2,-1,2; 3,1,1,2; -2,0,1,-1); Bes (1/1,0,-2)'; g x1 = inv(a)*B 32 = Bitinv(a') output values: x1‘ =X 2= [ -21-13] 5.11 % This program solves a system of linear equations. % A= [1,-2,1,1; 1,0,1, B= (3,0,0,1]'s 4 0,2, 7 1,4,2,-11; a X1 = inv(A)*B 32 = B'tinv(a') Output values: x1" = X2= [3 0.5 -1 2] 5.12 § This program solves a system of linear equations. 72,0,2,215 inv(A)*B B'*inv(a") output values: Xl! = X 2 = [3 0.5 -1 2] 5.13 % This program is used to verify if a set of equations % intersect uniquely in a given point. 8 A= (457; 2-13;1141; B= [36 32 5]'; 8 X=A\B ERR = sum(A*X-B) 5.14 % This program is used to verify if a set of equations & intersect uniquely in a given point. 8 A= (43-12; 2, -134;1111; 03011; B= (5.5, 26.5, 4.5, -1]'; s X = A\B; ERR = sum(A*X-B) wv Engineering Problem Solving with MATLAB, Second Edition by Delores M. Etter 5.15 % This program is used to verify if a set of equations intersect uniquely in a given point. [43 -120;2-1341;11111;03013;12345); 13, 2, 3, 3, Ute oe oD ar we ANB; ERR = sum(A*X-B) 18, Engineering Problem Solving with MATLAB, Second Edition by Delores M. Etter Chapter 6 6.1 § ‘This program reads the data for a manipulator % arm and checks for errors. 8 y. code = points(:,3); s % Generate three separate paths. & grasp = find (code==2) ; release = find(code lenx = length (x) ; x1 = x(1:grasp) ; yi = y(1:grasp) ; x2 = xigrasp:release); y2 = y(grasp:release) ; x3 = x(release:lenx); 3 = y(release:lemx) ; s % Use user-written functions to check for % increasing or decreasing x values. & if incr (x1) | decr (x1) disp("grasp path ok") else disp(‘error in grasp path’) disp( (x1 y1)) end if incr (x2) | decr(x2) disp(‘release path ok’) else disp(‘error in release path’) disp(b2,y21) end Af incr (x3) | decr (x3) disp('return path ok’) else disp(‘error in return path’) disp( [3,y3]) function y = incr (x) % INCR This function determines if the values s in the matrix x are in increasing order. % 8 = x); N = Length(s); ifN>1 Gif = 8(2:N) - 8(1:N-1); if length(find(dif<=0)) == 0 19 Engineering Problem Solving with MATLAB, Second Edition by Delores M. Etter 6.2 function y = decr (x) DECR This function determines if the values in the matrix x are in decreasing order. ax); = length(s); if > 1 dif = 5(2:N) - 5( eo wwe N-1) 5 if Length (find (dif>=0) yel else % This program counts the number of individual paths % in the movement plan of a manipulator arn. # x = points(:,1); points(:,2); code = points (:,3); s % Generate three separate paths. s grasp = length (find (code- Length (ind (code: fprint£('Nunber of paths: %6.0f \n',grasp+release+home-1) Engineering Problem Solving with MATLAB, Second Edition by Delores M. Biter 6.3 % ‘This program generates a data file for the interpolated path. % (Program assumes only three paths.) a x = points(:,1); Y = points code = points (:,3); & % Generate three separate paths 8 grasp = find (code=: release = find(code lenx = length (x) ; xd y(ligrasp) : x y(grasp:release) ; x3 = x(release:lenx); 3 = y(release:1enx) ; 8 & Compute the time increment and corresponding time sequences. & iner = min(abs (x(2:lenx)-x(1:1enx-1)))/10; x(1) :iner*sign (x(grasp)-x(1)) :x(grasp) ; x(grasp) :incr*sign (x (release) -x (grasp) ) :x(release) ; (release) : incr*sign (x (lem) -x (release) ) :x(1enx) ; [en t2 03); % Compute splines. a s1 = spline(x1,y1,t1); 82 = spline(x2/y2,t2); 53 = spline(x3,y3,t3); s = [si 52 53]; a & Keep track of path. 8 cl = ones(size(sl)); e1(1) = 0; €2 = ones(size(s2)); 2(1) = 2; 3 = ones(size(s3)); <3(1) = 3; 3 (Length(3) ) © = [el ¢2 3]; 8 Ni = length(t1); length (t2) ; length (t3) ; (ea (L:wa-2) t2(1 {s1(1:wi-1) 52(1 [el (1:wi-1) ¢2(1 paths= [tisic]'; save paths.dat paths -ascii N2-1) 3]; N2-1) 53]; 2 Engineering Problem Solving with MATLAB, Second Edition by Delores M. Etter 6.4 6.5 %& ‘This program prints the path from the interpolated data file. & load paths .dat x = paths(:,1); ¥ = paths(:,2); code = paths(:,3); & k = find (code==0|code==2|code==3) ; dots_x = x(k); dots_y = y(k); 8 plot ({t1 t2 t3], [s1 s2 53], dots_x,dots_y,'o'),... title("Path for Manipulator Arn'},... xdabel('x") ,ylabel (‘y') ,grid % ‘This program checks the manipular arm path for errors. & load points. dat x = points(:,1); y = points(:,2); ‘code = points (:,3); % mark = find (code==0 |code==2|code==3) ; if Length (mark disp("Error in codes') else for _kel: length (mark) -1 first = mark(k); last = mark(k+1) ; sx = x(first:last); sy = y(Eirst:last); LE iner(sx) | decr (sx) disp("path ok’) else disp('error in path') disp([sx sy]) end end end 22 Engineering Problem Solving with MATLAB, Second Edition by Delores M. Etter 6.6 % ‘This program checks the manipulator arm path for errors. & An intermediate stop is coded as 4 when arm changes dirction. s load input .dat xc = input (:,1); y = input (:,2); code = input (:,3); N= length (x); g signs = sign(x(2:N)-x(1:N-1)); chgs = signs (2:N-1)+signs(1:N-2); mark = find(chgs==0) ; for k = 1: length (mark) last = mark(k) + 1; if code (last) = code (last) end end s out (:,2) out (:,2) out (:/3) save points.dat out -ascii ee Solving with MATLAB, Second Edition by Delores 6.7 % ‘This progam checks the manipulator arm path for errors. & load points.dat = ds y = points (:,2); code = points(:,3); = length (x); & & If dirction changes, break into subpaths. 8 Gif = x(2:N) - x(1:N-1); signs = sign(dif); signs (2:N-1) signs (1:N-2); mark(k) + 1; if code(last) code (last) end end ® out (:,1) = x7 out (:,2) = yF out (:,3) = code; a % Insert new point between vertical moves in order to use spline & mark = find (dit final = points; while (Length (mark)~=0) final (mark(1) , 1) *1.05; (Zinal (mark(1),2) + final (mark(1)+1,2))/2; 4; [final (1:mark, [news newy newe] ; final (mark+1: length (points), : x = final (:,1); mark = find((x(2:N) - x(1 end save final.dat final -ascii (-1) )= Ne 24 Engineering Problem Solving with MATLAB, Second Edition by Delores M. Etter 6.8 % ‘This program sorts and condenses the oil production data & using a function to remove duplicate values. s load OIL. DAT oiltmp = reorder (OIL); save oiltmp.dat oiltmp -ascii s tmpoil = fliplr (reorder (f1iplx (OIL))}; save tmpoil.dat tmpoil -asc: function y = reorder (xx) REORDER This function sorts and condenses s the duplicate values in x. ® [nrows,ncols] = size(x); ae x(t1; b= (2,2); Thold, index] = sort (a); (index) ; (index) ; if = ax(2:length (ax) ) -axc(1: Length (ax)-1) ; k = find(aif<0.0001) ; ‘bac (Ke) = (ox (ie) +e (e+) ) /25 if length (k)~=0 if Length(k)>2 max = ax(1:k(1)); Length (k) [ax anc (Ie(n~1) #2: (n) )] (Che (2:ke (1) ) joe (e(1) #221 (2) ) se (k (2) +22 Length (be Hemet (2) 5 ase) +2 (2) ext (2) #2: Length (a) )] Engineering Problem Solving with MATLAB, Second Edition by Delores M. Etter 6.9 6.10 © ‘This program computes and plots two models for a data set. & oad tmpoil.dat ® oil = tmpoil(:,1); tmp = tmpoil (:,2); & coef2 = polyfit (tmp,oi1,2); coef3 = polyfit (tmp, oil,3); 8 sqerr2 = sum((oil-polyval (coef2, tmp)) .°2); sqerr3 = sun((oil-polyval (coef3, tmp) )."2); fprinté (‘order 2 Coefficients: \n'} disp(coef2) fprint£ (‘order 3 Coefficients: \n') disp(coef3) fprinté (‘Order 2 Error: €6.3£, Order 3 Error: $6.3f \n',... sqerr2, sgerr3) * temps = floor (min (tmp) ) :0.1:ceil (max (tmp) ); poly2 = polyval (coe£2, temps: poly3 = polyval (coe£3, temps); plot (tmp, oil, temps, poly2, temps,poly3), . title('Polynomial Medels'), ... xlabel (‘Tenperature') ,ylabel (‘Barrels of Oil'),grid % ‘This program computes two models for a data set. % load oiltmp.dat & oil = oiltmp(:,1); tmp = oiltmp(:,2); 3 coef2 = polyfit (oil, tmp,2); coef3 = polyfit (oil, tmp,3); a sgerr2 = sum((tmp-polyval (coef2,0i1)) .“2); sgerr3 = sum((tmp-polyval (coef3,0i1)) -*2); fprint£ (‘order 2 Coefficients: \n') disp (coef2) fprint£ (‘order 3 Coefficients: \n') disp (coe3) fprinté (‘Order 2 Error: 6.3£, Order 3 Error: &6.3£ \n', sgerr2, sgerr3) & oilprod = floor (min(oil)) :0.1:ceil (max(oil)) ; poly2 = polyval (coef2, cilprod) ; poly3 = polyval (coef3, oilprod) ; lot (011, tmp, of prod, poly2,ollpred, poly)... title( "Polynomial Models"), ... Saahel ('aavrels of O11") ylabel (‘Tenperatures') grid 26 Engineering Problem Solving with MATLAB, Second Edition by Delores M. Etter 6.11 % This program predicts oil production based on temperature. a load tmpoil.dat 8 coef3 = polyfit(tmp, oil, 3); a new_temp = input('Enter temperature: new_oil = polyval (coef3,new_temp) ; * fprint£ (Temperature: $6.2 \n‘,new_temp) fprinté (‘Predicted oil Production in Barrels: €6.2£ \n',new_oil) 7 Engineering Problem Solving with MATLAB, Second Edition by Delores M. Etter Chapter 7 Ta 7.2 7.3 14 function v = velocity(r,n,x0) & VELOCITY This function is related to the average 8 flow velocity of the pipe a ve r.t(1 ~ r/x0).*(1/n); % ‘This program generates a table of average flow velocity & for integer values of n from 5 to 10. 2 table = zeros(6,2); table(:,1) = [5:10]'; a integral = quad( ‘velocity’ ,0,0.5, (J, {]/n, 5); table(n-4,2) = (2*vmax/(.5*2))*integral; ana & disp(" nave flow vel") disp(table) % ‘This program generates a table of average flow velocity & for values of r0: 0.5,1,1.5,2 & table = zeros(4,2); table(:,1) = (0.5 11.5 2)"; a kea for x0=0. ‘ymax = 1. integral = quad(‘velocity’ ,0,0.5, 1, [],8,20); table(k,2) = (2*vmax/(x0*2))*integral; k=k+ 1; end & displ’ x0 ave flow vel") disp (table) 2; %& ‘This program allows the user to input vmax. max = input (‘Input value of vmx); Sneegral = quad( ‘velocity*,0.0.5, 1, [1,8,0.5)7 ve_velocity = (2*max/(.5%2))*integral; 28 Engineering Problem Solving with MATLAB, Second Edition by Delores M. Etter 75 & ‘This program computes velocity data from altitude data. 8 load altitude.dat altitude(:,1); altitude(:,2); N = length (time) ; & vel = diff(alt) . /diff (time) ; xvel = time(2:N); e subplot (2,1,1) plot (time, alt), title(‘Altitude') ,xlabel (‘ime’) , grid. subplot (2, 1,2) ,plot (x vel, vel) , . title(‘Velocity') ,xlabel ("Time ogrid & ‘This program computes acceleration data from altitude data. a load altitude.dat altitude(:,1); altitude(:,2); N = length (time) ; a vel = diff (alt) . /dift (time) ; x vel = time(2:N) acc = diff (vel) . /aifé (x vel) ; xace = time(3:N) ; & subplot (2, 1,1) plot (x vel, vel) , ... title(‘Velocity") ,xlabel (‘Time’) , grid, subplot (2, 1,2) ,plot (x_acc, acc) ,. title('Acceleration') ,xlabel ( ‘ime') grid % This program compare three ways of computing velocities. s load altitude.dat time = altitude alt = altitude( WN = length (time) ; & we 2)3 vel_l = diff (alt) . /diff (time); x1 = time(2:N); vel_2 = velli; x2 = time(1:N-1); vel_3 = (alt(3:N) - alt (1:N-2))./(time(3:N) - time(1:N-2)); x3 = time(2:N-1) & subplot (2, 1,1) ,plot (x 1,vel_1,%* 2, vel_2,*3,vel_3),. title( ‘Comparison of Velocity Calculations’); xdabel ("Time") ,arid 29 Engineering Problem Solving with MATLAB, Second Edition by Delores M. Etter 1.8 79 ‘This program uses numerical integration to compute velocity values from acceleration values. The trapezoidal rule is used to compute the area under the acceleration, and the increment in time is not assumed to be the same. If the initial velocity is not zero, then the initial velocity should be added to the all these velocity values. ewww wee load altitude.dat time = altitude! alt = altitude( N = length(time) ; & vel = diff (alt) . /dif£ (time) ; xvel = time(2:N); acc = diff (vel). /diff (x vel); xace = time(3:N) ; & %& Compute areas under acceleration curve to give velocity. & N = length(acc) ; bases = x acc(2:N) - xace(1:N-1); height1 = acc(1:N-1); height2 = acc(2:N); areas = 0.5*bases.*(heighti+height2) ; integral = cunsum(areas'); & plot (x_ace (1:N-1) , integral, xvel,vel),..- title( Velocity’) ,xlabel ("Time"), grid ue 2] ‘This program uses numerical integration to compute altitude values from velocity values. The trapezoidal rule is used to compute the area under the velocity, and the increment in time is not assumed to be the same. If the initial altitude is not zero, then the initial altitude should be added to the all these altitude values. load altitude.dat time = altitude(:,1); alt = altitude(:,2); N = length(time) ; & vel = diff (alt) . /diff (time) ; xvel = time(2:N); e & Compute areas under velocity curve to give altitude. & N = length(vel) ; bases = x vel (2 height = vel (1:N-1); hheight2 = vel (2:N) ; areas = 0.5*bases.* (heighti+height2) ; integral = cunsum(areas'); & plot (x vel (1:N-1), integral, time, alt) , title( ‘Altitude’ ) ,xlabel ("Time") grid ) = xvel(1:N-1); Engineering Problem Solving with MATLAB, Second Edition by Delores M. Etter 7.10 Jun % ‘This program compares the integral estimates of a function % using Simpson's rule and the trapezoidal rule. a 0:0.01:1; Arex (-x) 7 wre subplot (211) ,plot (x, £),... xdabel ('x') ,ylabel ("£(x)'), grid input (‘Enter left point of interval: ') input (‘Enter right point of interval: '); input (‘Enter even number of subintervals: '); & Estimate integral using Simpson's rule. a) Az; exp (acd) 3 b/3*(fxi (1) + 4*sum(fxi (2:2:N2)) + 2*sum (fxd (3:2:N2-1)) +£xi (N241) ); fprinté (‘Simpson rule integral estimate: 97.3£ \n',areal) * % Estimate integral using trapezoidal rule. a N = length(xi) + bases = xi(2:N)-xi(1:N-1); height = fi (1:N-1); height2 = fi (2:N); area? = sum(0.5*bases.* (heighti+height2)); fprint£("Trapezoidal rule integral estimate: %7.3£ \n',area2) % This program determines the inflection points in a function % by determining the locations where the second derivative % changes signs. & x 0.01:25 & Replace with new x computation. y = 8*%."5-5tx."4-20%.°3; & Replaced with new y computation. % N = length(x); Qed = x(2:); dyl = diff(y). /aif£(x); ML =N-1; 8 cbe2 = xt (2:01); ay2 = diff (dyl) . /diff (axl); 2 =Nl- 1; signprod = sign (dy2(: )-1)) . *sigm (dy2(2:N2)) ; ke = Find (signprod<0) ; disp( Inflection Points:') isp (Gx2 (k)) 31 Engineering Problem Solving with MATLAB, Second Edition by Delores M. Etter Chapter 8 8.1 8.2 % ‘This program computes the velocity and acceleration of an ® aircraft after a new thrust is applied, and then determines % the final cruise velocity. a initial_vel = 180; seconds = 240; [t,mum_v] = 0de23('g',0,seconds, initial_vel); ace = 3 - 0.000062*num_.°2; s subplot (2,1,1) plot (t,num_v) ,title(‘Velocity"),... xlabel('Time, s'), ylabel('m/s'},grid,... subplot (2,1,2) plot (t,acc) , title('Acceleration'),... xlabel(‘Time, s'), ylabel('m/s*2') grid & % ‘The cruise velocity occurs when the slope of the % velocity is close to zero. 8 WN = length(t); slopes = abs (num_v(3:N) -num_y(1:N-2))./(t(3:N)-t(1:N-2)); index = find(slopes<0.01) ; if length(index) -= 0 fprint£ (‘New cruise velocity is %6.2£ m/sec.\n',. num_v (index(1)+1)) else fprint£ (‘Cruise velocity has not been reached. \n') end % ‘This program computes the velocity and acceleration of an ® aircraft after a new thrust is applied, and then determines % the final cruise velocity and the time it was achieved. 2 initial_vel = 180; seconds = 240; [t,num_v] = ode23(*g",0, seconds, initial_vel) ; ace = 3 - 0.000062*num_v.*2; ® subplot (2, 1,1) plot (t,num_v) , title('Velocity'), xlabel('Time, s'), ylabel('m/s'),grid, . subplot (2, 1,2) plot (t,acc) , title('Acceleration'),... xlabel( ‘Time, s'), ylabel('m/s*2"),grid * % The cruise velocity occurs when the slope of the % velocity is close to zero. a N= length(t); slopes = abs (mum_yv(3:N) -num_v(1:N-2))./(t (3:N)-t (1:N-2)); index = find(slopes<0.01) ; if length (index) ~=0 Eprint£('New cruise velocity is 46.2 m/sec.\n',... num_v (index(1)+1)) fprint£('New cruise velocity achieved at %6.2£ sec. \n',... (index (1)+1)) else fprintf (‘Cruise velocity has not been reached. \n') end 32 Engineering Problem Solving with MATLAB, Second Edition by Delores M. Etter 8.3 8.5 % This program computes the velocity and acceleration of an ® aircraft after a new thrust is applied, and then determines & the final cruise velocity from the acceleration. a initial_vel = 180; seconds = 240; (t,num_v] = ode23('g',0,seconds, initial vel) ; ace = 3 - 0.000062*numv.“27 s subplot (2,1, 1) plot (t,num_v) , title('Velocity'),... xdabel('Time, s"), ylabel('n/s'),grid, subplot (2, 1,2) plot (t,acc} ,title('Acceleration'), xdabel('Time, s'), ylabel(‘m/s*2") ,grid s N = length(t); acc_avg = abs(acc(1:N-2) + acc(2:N-1) + acc(3:N))/3; index = find(acc_avg<0.01) ; if length(index) ~= 0 fprint£ (‘New cruise velocity is %6.2£ m/sec.\n', nnum_v (index (1)+1)) else fprint£('Cruise velocity has not been reached. \n') % ‘This program computes the velocity and acceleration of an % aircraft after a new thrust is applied. & initial_vel = 180; seconds = 240; (e,num_v] = ode23('g', 0, seconds, initial vel) ; ace = 3 - 0.000062*num_v.*2; & vmph = 2.237¢numv; accfps = 3.281*acc; % subplot (2,1,1) ,plot (t,vmph) ,title(‘Velocity"),..- xlabel("Time, s'), ylabel ( 'mi/nr') grid, subplot (2,1,2) plot (t,accfps) , title(‘Acceleration'), xlabel( ‘Time, s'), ylabel(’ft/s*2'),grid % This program computes the volume of pollutants in a lake % as a funcion of time. & initial x = 0.229; years = 5; (t,mumx] = ode23('p',0,years, initial x); & plot (t,mum_x) ,title('Pollution Concentrations"), ... xlabel (Time, yrs") ,ylabel (‘Volume’), grid function dx = p(t,x) &p This function of time and pollutant volume computes the % value of a differential equation given pollutant values. & x = 0.0175 - 0.3821%x; 33 Engineering Problem Solving with MATLAB, Second Edition by Delores M. Etter 8.6 8.9 & This program uses linear interpolation with the results % of the ode23 function to determine when the pollution % is equal to 0.1; a initial_x = 0.229; years = 5; [t,numx] = ode23('p',0,years, initial x); 8 tab = (numx t]; time = tablel (tab, 0.1); g fprint£ (‘The time required is %6.2f yrs. \n‘, time) Program output: ‘The time required is 3.19 yrs. & ‘This program computes the numerical and analytical solutions % for the volume of polutants in a lake as a function of time. a initial _x = 0.229; years = 5; [te numx) = ode23('p',0, years, initial_x) ; ax = 0.0458 + 0.1832%exp(-0.3821"t); 2 plot (t,mumx,t,a.x,'0'),..- title('Nunerical and Analytical Solutions'),... xlabel (Time, yrs'),ylabel(*Volume') ,grid & Using the value of the pollution volume of 0.1 the & time value can be computed as shown 8 t = log((0.1-0.0458) /0.1832) /(-0.3821); fprint£ (‘t= $14f yrs \n',t) Program output: t = 3.1874 yrs % ‘This program computes the amount of salt in the tank % as a function of time 8 initial_x = 90.0; minutes = 30 [t,num_x] = ode23('s',0,minutes, initial x); a plot (t,mum_x) ,title('salt'),... xdabel(‘Time, minutes'),ylabel(‘Weight, pounds') ,grid function dx = s(t,x) %s This functon of time and weight of salt computes the & value of a differential equation given weight values. & de = 8 ~ 34x/ (904); Engineering Problem Solving with MATLAB, Second Edition by Delores M. Etter 8.10 % This program computes the amount of salt in the tank % as a function of time, and then uses linear interpolation to % find the time at which there is 150 pounds of salt in the tank. & initial x = 90.0; minutes = 30; [t,num_x] = ode23('s',0,minutes, initial_x); 3 tab = (numx t]; time = tablel (tab, 150) ; a fprint£ (‘The time required is $6.2 sec. \n', time) Program output: ‘The time required is 14.10 sec. 8.11 §% This program computes the numerical and analytical & solutions for the amount of salt in the tank as a % function of time. % initial x = 90.0; minutes = 30; {t,mumx] = 04e23('s',0,minutes, initial x); 8 ax = 2*(904t) = (9074) ./(904t) .73; g plot (t,mumx, t,x, '0"), +++ title('Numerical and Analytical Solutions’), . xlabel(‘Time, minutes'),ylabel(‘Weight, pounds‘) ,grid 8.12 % Using the value of the 150 pounds of salt, the % corresponding analytical solution can be rewritten % asa polynomial. The time value desired is a root % of the polynomial. a £ = conv({[2 30],conv({1,90],conv({1 90], {1 90}))); £(5) = £(5) = 90%; roots (f) ‘The only positive root is equal to 14.09 minutes. 35 Engineering Problem Solving with MATLAB, Second Edition by Delores M. Etter 8.13 % ‘This program integrates equation (1) for the bungee jumper % and determines time and velocity at 150 m. e tstart = 0; tlend = input (‘Enter time interval: *); initial = [0 01; & [t,numy) = ode23(‘eqnsi', t_start, t_end, initial); v= mum y(:,1); Qe mmy(s2); index = find(d-150>0); if length(index) == 0 fprint£ (‘Choose larger interval \n') else 8 & Interpolate for values at distance=150. 8 k = index(1); info(1:2,1) = d(k-:k); Anfo(1:2,2) = t (k-1:k); Snfo(1:2,3) = v(ke1:k); results = tablel (info, 150); 150 = results(1); vi50 = results (2); fprint£ (‘Distance = 150 m at time: %6.2£ \n',t150) fprinté ( ‘Corresponding velocity: %6.2£ \n',v150) end function u_prime = eqnsl(t,u) % eqnsi This function assumes the distance % is less than 150 m. 8 wprime(1) = (686 - 0.227*u(1)*2)/70; (Ds uprime(2) 36 Engineering Problem Solving with MATLAB, Second Edition by Delores M. Etter 8.14 % ‘This program integrates equation (1) until the bungee becomes ® taut at x = 150 m, and then integrates equation (2) after the % ‘bungee is taut. It also computes the acceleration. s tstart = t150; tlinter = input (‘Enter time interval: '); tend = t_start+t_inter; initial = [v150 150]; s % Determine and plot velocity, distance, acceleration. eqns? (t (Kk) ,num_y (I, :)); a = wprime(:,1); subplot (2, 1,1) ,plot (t,v) ,title( 'Velocity"),... xlabel( ‘Time (s)') ,ylabel ('m/s') , grid, . subplot (2, 1,2) plot (t,d) , title('Distance'),... xlabel( "Time (s)') ,ylabel('m') grid, pause elg subplot (2,1,1) plot (t,a) ,title('Acceleration'),... xlabel( "Time (s)'),ylabel ('m/s*2'), grid, pause a peak.d = max(d); (maxv,maxk] = max(abs(v)) + peak_v = v(maxk(1)); [maxa,maxdk] = max (abs (a)); peak_A = amaxk(1)); find (d==peak_d) ; fall_time = t(index(1)); fprint£('Peak distance, velocity, acceleration: \n'); fprintf(' %6.2£,%6.2£,%6.2£ \n',peak_d,peak_v,peak_a) fprint£ (‘Number of gs: $6.1f \n',peak_a/9.8) fprint£ (‘Fall time: %6.1£ seconds \n', fall_time) fprintf (‘Balloon height for safety factor of 4: $6.1f \n', 4*peak_d) function u_prime = eqns2(t,u) & eqns2 This function can be used with distances 8 greater than 150 or less that 150 meters & len = 150; if u(2) <= b len wprime(1) = (686 - 0.2274u(1)*2)/70; else wprime(1) (686 - 0.227*u(1)*2 ~ 10.0*(u(2) - b_len))/70; uprime(2) = u(1); 37 Engineering Problem Solving with MATLAB, Second Edition by Delores M. Biter 8.15 % This program plots the distance values assuming that % that the bungee also has a viscous friction force. a tstart = t150; tLinter = input (‘Enter time interval: tlend = t_start+t_inter; initial = [v150 150); ® % Determine and plot distance. 3 [t,mum_y] = ode23(‘eqns3', t_start, t_end, initial); v= mum y(/1); d= mumy(:,2); N = length(t); for k = 1:n uprime(k,:) = eqns2(t(k) mum_y(k,:))7 end a = uprime(:,1); & subplot (2,1,1) ,plot (t,v) , title(‘Velocity"), xlabel ("Time (s)') ylabel ("m/s") grid, ..- subplot (2, 1,2) plot (t,d) ,title(‘Distance’),... xlabel (‘Time (s)'),ylabel('m') ,grid, pause clg subplot (2,1, ) plot (t,a) ,title(‘Acceleration'),... xlabel ("Tine (s)'},ylabel('m/s*2") grid, pause & peak_d = max(d); {maze maxdk] = max (abs (v)) 7 peak_v = v(maxk(1)) ; (maxa,maxk] = max(abs(a)); peak_a = a(maxk(1)) ; index = find(d=-peak_4) ; fall_time = t (index(1)); fprint£ (‘Peak distance, velocity, acceleration \n') fprinté (+#6.2£,%6.2£,%6.2f \n' ,peak_d,peak_v,peak_a) fprint (‘Number of gs: $6.1£ \n',peak’a/9.8) fprint£ (‘Fall time: €6.1f seconds \n‘, fali_time) fprint£ (‘Balloon height for safety factor of 4: %6.1f \n',... ‘4*peak_d) function u_prime = eqns3(t,u) % ems3 This function adds a viscous friction force & blen = 150; fric = 1.5; if u(2) <= ben wprime(i) = (686 - 0.227%u(1)*2)/70; else wprime(1) = (686 - 0.227*u(1)*2 - 10.0*(u(2) - ben)... = frictu(1))/70; end woprime(2) = u(1); 38 Engineering Problem Solving with MATLAB, Second Edition by Delores M. Biter 8.16 8.17 ‘The following program determines the peak acceleration for a value of the length of the bungee that must be specified in the function eqns3.m. Different values of the length must be tried in order to find a bungee length with a peak acceleration of approximately 2 g's ‘This program computes acceleration and distances assuming that that the bungee also has a viscous friction force wen nrnwne tstart = t150; input (‘Enter time interval: — _start+t_inter; initial = [v150 150]; 8 % Determine and plot velocity, distance, acceleration. N = length(t); for k = 1:N w_prime (k, ‘eqns3 (t (Je) -mum_y (Ie, :)); fprint£ (‘Peak upward acceleration %6.1f gs \n',... min(a) /9.8) fprinté (‘Maximum distance below the balloon: %6.1f meters \n',... max (a) ) ‘The program in problem 8.16 determines the peak acceleration for a set of input parameters. In order to vary the arresting force for a specific length of bungee, we must change the function eqns3.m. (The arresting force is determined by the material used in the bungee.) ‘The arresting force is a value b times the nunber of meters of stretch beyond 150m, or B = b(x - 150). Different values of the parameter b must be tried in order to find an arresting force with a peak acceleration of approximately 0.8 g's. The modified function used with the program from problem 8.16 is shown below. 1 00 20 60 0 0 0 0 oP function u prime = eqns3(t,u) eqs} This function adds a viscous friction force. & arrest_b = 10.0; bien = 150; fric = 7.0; if u(2) <= blen, uprime(1) = (686 - 0.227*u(1)2)/70; else ‘wprime(1) = (686 - 0.227u(1)*2 - arrest_b*(u(2) - bien)... = feictu(1))/70; ena uprime(2) = u(1); 39 Engineering Problem Solving with MATLAB, Second Edition by Delores M. Etter 8.18 % ‘The new drag constant is computed as follows: & = 686/(1202) = 0.04764 %& ‘The program and function for computing the acceleration & are modified to the following: & & ‘This program computes the acceleration for a bungee of % 300 meters assuming streamlining into the wind and a % viscous friction force. & tstart = input (‘Enter start time: ') tLend = input (‘Enter ending time: ' initial = input(‘Enter initial velocity and distance: '); % Determine and plot velocity, distance, acceleration. ode23 (‘eqns4', t_start, tend, initial) ; 1; mum_y(2/2); length (t) ; for wprime(k, + end a= wprime(:,1); = % net force is mass times acceleration egns2(t (k) -mumy (Ky =) elg subplot (211) ,plot(t net) ,title(‘Net Force’)... xlabel('Time (s)'),ylabel('Newtons'),grid 8 peak_a = max(a) ; Tasers) = mast(abe (v)) peaie sy = vimaxce(1))2 (maxa,maxk] = max(abs(a)) ; peakea = a(mawk(t))7 index = find(d==peak_d) fall_time = €(intex(i)); fpintf('Peak velocity: %6.2f \n',peak_v) fprint£ (‘Maximum g level: %6.1f \n',peak_a/9.8) fprint£ (‘Maximum distance below balloon: %6.2f \n',peak_d) function u_prime = eqns4(t,u) 8 eqnst “This function computes the acceleration with streamlining into the wind. : bien = 150; fric = 7.0; if u(2) <= bien uprime(1) = (686 - 0.04764*u(1)*2)/70; else ‘uprime(1) = (686 - 0.04764¥u(1)*2 - 10.0*(u(2) - bien)... = frictu(1))/70; end uwprime(2) = u(1); Engineering Problem Solving with MATLAB, Second Edition by Delores M. Etter Input values: —t_start initial Program output: Peak velocity: 51.90 Maximum g level: -1.5 Maximum distance below balloon: 319.14 ‘The time to come to rest and final stretched length are the same as those computed in problem 8.15. Input values: t_start = 0; t_end = 100; initial = [0 0]; length = 300 1 69.24 Maximum g level: '-2.0 Maximum distance below balloon: 500.70 41 ngigerng Problem Solving with MATLAB, Second Edition lores: Chapter 9 9.1% This program determines the amount of water in a tank 2 after x seconde. eq = '50-t* synvar (eq, 't") disp( ‘Amount of water in tank after x seconds: ') Q = int(eq,0, 'x") 9.2 % This program evaluates Q to determine how % much water is in the tank at 30 seconds eq = '50-t'; symvar (eq, 't") Os snk (ag.0, 7 sym2poly (Q) ; dispCancunt of water in tank after 30 seconds water = polyval(y,30) 9.3. % This program determines how mich water flows % between 10 and 15 seconds eq = '50-t'; symvar (eq, 't"); Q = int(eq, 0, 'x'); ¥ = syn2poly (9); Gisp(*Water flow between 10 and 15 seconds: ') water = polyval (y,15)-polyval (y,10) 9.4 % This program determines a symbolic expression for % determining the amount of work involved in stretching & a spring eq = "208%"; symvar (eq, 'x') m= nel"; disp(‘Amount of work to stretch spring ton ft:") W = int(eq,0, ‘n-1") 9.5 % This program determines the amount of work & necessary to stretch the spring to 2 ft. eq = '20%%'; symverteq,'%') int (eq, 0, 'n-1') y = sym2poly (W) > disp ("Amount of work to stretch spring to 2 ft: work = polyval (y,2); 9.6 ‘This program determines the length of the spring if work = 25 ft/lb. = 120%x"; Lint (eg,0,'n-1") t= 25']; a & eq, eq 8 § (Length of string for work of 25 £t/1b: solve (eq2) 42 Engineering Problem Solving with MATLAB, Second Edition by Delores M. Etter Chapter 10 10.1 % ‘This program generates three signals for testing the & channel separation filters. = 1/1000; = 03499; nexae 4 cos (2*pi*25*K*T) = 0.5*c0s(2*pi*40*k*T) + 0. 6*sin(2*pi*75*k*T+pi/5) ; Sig? = 2*sin(2*pi*500*k*T) + 0.1*cos(2*pi*730*k*T) +... cos (2*pi*850*k*T) ; sig3 = 1.5*cos(2*pir3500*k*T) - 0.5*sin(2*pi*4000*K"T) + ... 0.9*cos (2*pi*4200*k*T-pi/6) subplot (3, 1,1) ,plot (k*T,sigl) , title(*Signal 1'),... xlabel(‘Time, s'), grid... subplot (3, 1,2) ,plot (k*T, sig2) , title(‘signal 2"), xlabel('Time, s'),arid,... subplot (3, 1,3) plot (k*T,sig3) , title( ‘Signal 3'),... xlabel (Time, s),grid,pause a signal (eet); signall sigh’; save signall.dat signall -ascii signal2(:,1) = (k*T)"; signal2(:,2) = sig2'; save signal2.dat signal2 -ascii signal3 Geer)"; signal} 8ig3': save signal3.dat signal3 -ascii 43 Engineering Problem Solving with MATLAB, Second Edition by Delores M. Biter 10.2 % his program plots the magnitude and phase of the frequency % contents of the three signals generated. % load signall.dat load signal2.dat load signal3.dat & sigh = signall(:,2); sig? = signal2(:,2); sig3 = signal3(:/2); * Sl = ££t(sigl,512); S2 = ££t(sig2,512); 3 = f£t(sig3,512); ke = 0:255; 1/10000; 1/(512*9) ; ke incr; & subplot (2, 1,1) ,plot (hz, abs ($1(1:256))), title(‘Signal 1"), xlabel (‘Hz') ,ylabel (‘Magnitude’) ,grid, . subplot (2, 1,2) ,plot (hz, angle(S1(1:256))),title(*Signal 1'),.. xlabel ('Hz'),ylabel Phase"), grid,pause elg subplot (2,1,1) ,plot (hz, abs (S2(1:256))), title('Signal 2"), xlabel (‘Hz'),ylabel (‘Magnitude') grid, ... subplot (2, 1,2) ,plot (hz, angle (S2(1:256))),title( "Signal 2'),... xlabel (‘Hiz'),ylabel ("Phase") ,grid,pause elg subplot (2, 1,1) plot (hz, abs (S3(1:256))) ,title('Signal 3"), xdabel (‘Hz') ,ylabel (‘Magnitude’) grid, ... subplot (2, 1,2) ,plot (hz, angle ($3 (1:256))) ,title( ‘Signal 3"),... xlabel ( ‘Hz'),ylabel ("Phase"), grid, pause 10.3% ‘This program generates the sum of the three signals, and plots & the time domain of the sum and the magnitude of the frequency 8 domain of the sum. 2 load signali.dat load signal2.dat load signal3-dat s sum(:,1) = signall(:,1); sum(:,2) = signall(:,2) + signal2(:,2) + signal3(:,2); S = #ft(sum(:,2),512); 8 i = 01255; T = 1/1000; iner = 1/(512*T); hz = k*iner; & subplot (2, 1,1) ,plot (sum(: ,1), sum(:,2)),title('Sum of Signals'),... xlabel('Time, s*), grid, . subplot (2, 1,2) ,plot (hz, abs ($(1:256))), title(*sum of Signals’), xdabel ( z') ,ylabel (‘Magnitude’) , grid, pause save sum.dat sum -ascii Engineering Problem Solving with MATLAB, Second Edition by Delores M. Biter 10.4 % ‘This program applies the lowpass filter to the signal sum % generated in problems 10.3. a & fs = 10000; £5/2; 1/8; (B1,Al] = butter(8,100/fn) ; y = filter (BL,Al,x); ¥ = fft(y,512); a k = 0:255; incr = 1/(512*T); hz = k*incr; 8 subplot (2,1,1) ,plot (time,y) , title('Lowpass Filter Output'),... xdabel(‘Time, s*),grid, ... subplot (2, 1,2) ,plot (hz, abs (¥(1:256) )) ,xLabel ("Hz")... title('Lowpass Filter Output’) ,ylabel (‘Magnitude’), grid 10.5 % ‘This program applies the bandpass filter to the signal sum 8 generated in problems 10.3. 8 load sum.dat (B2,A2] = butter (7, (500/fn,1000/fn]); y = filter (B2,A2,x) ; ¥ = fft(y,512); 2 k = 0:255; incr = 1/(512*T); hz = ktiner; s subplot (2,1,1) plot (time,y) ,title( ‘Bandpass Filter Output'),... xlabel('Time, s'), grid, ... subplot (2, 1,2) ,plot (hz, abs(¥(1:256))), xlabel ('Hz'), . title('Bandpass Filter Output’) ,ylabel (‘Magnitude'), grid 45 Engineering Problem Solving with MATLAB, Second Edition by Delores M. Etter 10.6 10.7 % ‘This program applies the highpass filter to the signal sum % generated in problems 10.3. s load sum.dat ne x = sum(:,2); 10000; £5/2; L/fs; [83,a3] = butter (10,2000/fn, ‘high'); y = filter (B3,A3,20; ¥ = f£t(y,512); g ke = 0:255; incr = 1/(512*T); hz = ktiner; & subplot (2,1,1) ,plot (time,y) ,title(‘Highpass Pilter output"), ... ‘label (Time, s') arid, subplot (2,1,2) ,plot (hz, abs (¥(1:256))),xlabel('Hz'),... title(‘Highbass Filter Output'),ylabel ( Magnitude’) ,grid % ‘These statements plot the magnitude of a filter & w 1:5; B= 0.5279]; A = [1,1.0275,0.5279]; Hs = freqs(B,A,w); & plot (w, abs (Hs) ), title(‘Problem 10.7'),..+ xdabel ('w, rps") ,ylabel (‘Magnitude’) ,crid 8 % From plot, determined it was a low-pass filter. % disp( ‘Filter Characteristics in rps") isp('Passband: ') passband = [0 w(min(find(abs(Hs)<.7)))] isp( ‘Transition Band: ") tranband = [w(min (find (abs (Hs)<.7))) w(min (find (abs (Hs)<.1)))) disp('Stopband: ') stopband = [w(min(£ind(abs(Hs)<.1))) inf) Engineering Problem Solving with MATLAB, Second Edition by Delores M. Etter 10.8 10.9 % ‘These statements plot the magnitude of a filter. & w = 0:0,01:0.3; (2,0, 0); A = (1,0.1117, 0.0062]; Hs = freqs(B,A,w); a plot (w, abs (Hs)),title('Problem 10.8" wdabel ('w,xps") ,ylabel (‘Magnitude’) grid ® % From plot, determined it was a high-pass filter. a disp( ‘Filter Characteristics in rps") disp(*Passband: ') passband = [w(max(find(abs(Hs)<.7))) inf] disp( ‘Transition Band: ") tranband = [w(max(find(abs(Hs)<.1))) w(max(find (abs (Hs)<.7)))] disp('Stopband: ') stopband = [0 w(max(£ind(abs(Hs)<.1))) ] & ‘These statements plot the magnitude of a filter. a w = 0:0.01:20; B= [1.05,0]; A= [1,1.05,0.4471; Hs = freqs(B,A,w) ; 2 plot (w, abs (Hs) ), title(*Problem 10.9"), xdabel (‘w, rps") ,ylabel ( Magnitude) , grid * % From plot, determined to be a bandpass filter. a disp(‘Filter Characteristics in rps") isp (‘Stopband stopbandl = [0 w(min (find (abs (Hs)>.1)))] disp(‘Transition Band 1:') ‘tranband] = [w(min(find(abs(Hs)>.1))) w(min(£ind (abs (Hs)>.7)))] disp (‘Passband: ') passband = [w(min(find(abs(Hs)>.7))) w(mase(find (abs (Hs)>.7)))] disp("Transition Band 2:') tranband2 = [w(max(find(abs(Hs)>.7))) w(max(find (abs (Hs)>.1)))] disp(‘Stopband 2:') stopband2 = [w(max(find(abs(Hs)>.1))) inf] a Engineering Problem Solving with MATLAB, Second Edition by Delores M. Biter 10.10 10.11 % ‘These statements plot the magnitude of a filter. = 0:0.1:5; [1,0,2.2359) (2,2.3811, 2.2359]; Hs = freqs(B,A,w); & plot (w, abs (Hs)),title(*Problem 10.10'),... xlabel ('w, rps") ,ylabel (‘Magnitude'),grid 2 & From plot, determined to be a bandstop filter. & disp( ‘Filter Characteristics in rps") disp(*Passband 1:") passband1 = [0 w(min(find(abs(Hs)<.7)))] disp(‘Transition Band 1:') tranbandl = [w(min(find(abs(Hs)<.7))) w(min (find (abs (Hs)<.1)))] disp(‘Stopband: stopband = [w(min(find(abs (Hs)<.1))) w(max(find (abs (Hs)<.1)))] disp(‘Transition Band 2:') tranband2 = [w(max(find(abs(Hs)<.1))) w(max(find (abs (Es)<.7)))] disp(‘Passband 2:') passband? = [w(max(find(abs(Hs)<.7))) inf) pws e & These statements plot the magnitude of a filter. B = [0.2066,0.4131, 0.2066); A= [1,-0.3695, 0.1958); [#,wt] = fregz(B,A, 100) ; a plot (w?, abs (H)), title(‘Problem 10.11"), . xlabel ( ‘Normalized Frequency’) ,ylabel (‘Magnitude'),grid s % From plot, determined to be a lowpass filter. a disp( ‘Filter Characteristics in radians’) disp(‘Passband: ') passband = (0 wD (min (find (abs (H)<.7)))] disp( ‘Transition Band:") tranband = [wD (min (find (abs (#)<.7))) wP (min (find (abs (H)<.1)))) disp('Stopband: ') stopband = [wT(min(£ind(abs(i)<.1))) pi] Engineering Problem Solving with MATLAB, Second Edition by Delores M. Etter 10.12 10.13 & ‘These statements plot the magnitude of a filter. 8 B= [0.894,-1.789,0.894); A= [1,-1.778,0.799]; (H,w0] = freqz (B,A, 100) ; a plot (wT, abs (H)), title(*Problem 10.12"), ... xlabel (‘Normalized Frequency’ ) ,ylabel ('Magnitude') ,grid a & From the plot, determined to be a high pass filter. 8 disp(‘Filter Characteristics in radians’) isp ('Passband: ') paaabend © fvP(amx(tind abe H)<.7))) pi] isp( ‘Transition Band: eantond = [wi (mas (find (obs (H)<.1))) wP(mme(tind (abs (H)<.7)))1 disp('Stopband: ') stopband = [0 wP(max(find (abs (H)<.1)))] % These statements plot the magnitude of a filter. & B = [0.42,0,-0.42]; A= [1,-0.443, 0.159]; (H,wt] = freqz(B,A, 100); & plot (wP, abs (H)),title(*Problem 10.13"), ... xdabel (‘Normalized Frequency’) ,ylabel (‘Magnitude’), grid s % From plot, determined to be a bandpass filter. & disp( ‘Filter Characteristics in radians") disp( 'Stopbend 1:') stopbandl = [0 wP'(min(find(abs(H)>.1))) 1 disp( ‘Transition Band 1:') tranbandl = [wP (min(£ind(abs(H)>.1))) w2(min(£ind (abs (H)>.7)))1 disp(''Passband: ') passband = [w?(min(find(abs(H)>.7))) w0(max(£ind (abs (H)>.7)))] disp( "Transition Band 2:') tranband2 = [wT (max (find (abs (H)>.7))) wP (max (find (abs (H)>.1)))] disp('Stop Band 2:') stopband2 = [wM'(max(£ind(abs(#)>.1))) pi] 49 Engineering Problem Solving with MATLAB, Second Edition by Delores M. Etter 10.14 10.15 % ‘These statements plot the magnitude of a filter. = (0.5792, 0.4425,0.5792) ; [1, 0.4425, 0.1584] ; (H,wP] = freqz(B,A, 100); poe Lot (wP,abs(H)), title('Problem 10.14"), . xlabel (‘Normalized Frequency’) ,ylabel (‘Magnitude’), grid oye. % From plot, determined to be a bandstop filter. & disp( ‘Filter Characteristics in radians') disp(*Passband 1:') passbandl = [0 wf(min(find(abs (H)<.7)})] disp('Transition Band 1:') tranbandl = [wT (min (find (abs(H)<.7))) wD (min (£ind (abs (H)<.1)))] disp(''Stopband: ') stopband = [w? (min(find(abs(H)<.1))) w2(max(find(abs (H)<.1)))] disp(‘Transition Band 2:') tranband2 = [wT (max(£ind(abs(H)<.1))) wP(max (find (abs (H)<.7)))] disp(‘Passband 2:') passband? = [w?(max(find(abs(H)<.7))) pil % These statements plot the magnitude of a filter. 2 B = [0,0.04,0.17,0.25,0.17,0.04]; [H,w2] = freqz (B, 1,100); s plot (w?, abs (H)), title('Problem 10.15"), ... xdabel (‘Normalized Frequency’), ylabel (‘Magnitude’) , grid 3 % From plot, determined to be a low pass filter. 3 disp( ‘Filter Characteristics in radians’) disp( 'Passband: ') passband = [0 w? (min (find (abs (H)<.7)))] disp('Transition Band: ") ‘tranband = [wT (min find (abs (H)<.7))) w2 (min (find (abs ()<.1)))] disp('Stopband: ') stopband = [wD'(min(find(abs(#)<.1))) pi] 50 Engineering Problem Solving with MATLAB, Second Edition by Delores M. Etter 10.16 10.17 % These statements plot the magnitude of a filter. a B = [0.42,0,-0.42]; A= [1,-0.44,0.16]; (H,wt] = freqz(B,A,100); g plot (w?,abs (H)),title('Problem 10.16"), xlabel (‘Normalized Frequency’), ylabel (‘Magnitude’), grid 3 & From plot, determined to be a bandpass filter. & disp('Filter Characteristics in radians’) disp('Stopband 1:') stopbandl = [0 wM(min(£ind(abs(H)>.1))) disp( ‘Transition Band 1:') tranbandl = [wT (min (find (abs(#)>.1))) wP(min (£ind (abs (H)>.7)))1 disp('Passband: ') passband = [wP'(min(find(abs(H)>.7))) wY (max (find (abs (#}>.7))) 1 disp(‘Transition Band 2:') tranband2 = [wT (max(£ind(abs(H)>.7))) wP(max (find (abs (H)>.1)))] disp(‘Stopband 2:') stopband2 = [wT (max(find(abs(H)>.1))} pil ‘These statements plot the magnitude of a filter. Note that the transfer function for this filter had to be computed without the freqz function since the transfer function includes a term with a positive power of z. 30 n ewe wT = O:pi/99:pi; Zl = @@(5*w!); ZA = exp(-itwr); H = 0.33421 + 0.33 + 0.33*21; ® plot (w?, abs (H)), title(*Problem 10.17"), . xdabel (‘Normalized Frequency’) ,ylabel (‘Magnitude’), grid ® % From plot, determined to be a bandstop filter. & disp( ‘Filter Characteristics in radians’) isp('Passband 1:') passbandl = [0 wM'(min(find(abs(H)<.7)))] isp( ‘Transition Band 1:') tranbandl = [wT (min (find (abs (H)<.7))) wP(min (find (abs (H)<.1)))) isp('Stopband:') stopband = [wP'(min (find (abs(#)<.1))) wP (max (find (abs (#)<.1))) 1 isp( "Transition Band: ") tranband2 = [w?(max(find (abs (H)<.1))) wP(max(£ind (abs (H)<.7)))1 disp('Passband:') passband? = [wP'(max(find(abs(H)<.7))) pi] 51 Engineering Problem Solving with MATLAB, Second Edition by Delores M. Etter 10.18 10.19 % ‘These statements plot the magnitude of a filter. % B = (0.33,0.33,0.33}; [A,wE] = freqz(B, 1,100) ; & plot (w?, abs (H)),title('Problem 10.18"),... xdabel ( ‘Normalized Frequency’) ,ylabel (‘Magnitude’) ,grid s % From plot, determined to be a bandstop filter. & disp (‘Filter Characteristics in radians‘) disp(‘Passband 1:') passband] = [0 wP(min (find (abs (H)<.7)))] disp(‘Transition Band 1:') tranbandl = [wP (min (find (abs (#)<.7))) wP(min (find (abs (H)<.1)))] isp(‘Stopband: ') stopband = [wD (min (find (abs (#)<.1))) wT (max (find (abs (H)<.1)))) isp("Transition Band 2:") ‘tranband2 = [wP(max(find (abs (H)<.1))) wt (max (find (abs (#)<.7)))] disp("Passband 2") passband? = [wT(max(find(abs(H)<.7))) pil % This program compares lowpass filter designs using the % four standard IIR filter types. 8000; £5/23 ts; 8; 1000/£n; 0.5; batter (N,wn) ; chebyl (N, Rp, wn) + cheby2 (N, Rs, wn); ellip(N, Rp, Rs,wn); freqz(B1,A1,100) ; (a2,wr] = freqz(B2,A2,100); (w3,wr] = freqz(B3,A3,100); (aa,wr] = fregz (B4,A4,100) ; hz = wI/(2*pi*T); & plot (hz, abs (HL) ,hz, abs (#2) ,hz, abs (H3) ,hz, abs (H4)),... title( Comparison of IIR Filters’), xdabel ( ‘Hertz') ,ylabel (Magnitude!) ,grid 52 Engineering Problem Solving with MATLAB, Second Edition by Delores M. Etter 10.20% This program compares an FIR design with an IIR design. & 1500; £5/2; Es; 500/fn; [B1,Al] = ellip(N,Rp,Rs,wn, ‘high'); & N= 32; [0 0.2 0.2 0.3 0.4 0.5 0.75 0.8 0.9 11; 10) OG 00 02 0 eee 17) B2 = remez(N,£,m); ® (HL,wE) = freqz (B1,A1,100) ; (H2,wt] = fregz (B2,1,100) ; hz 4 w0/(2*pi*); a plot (hz, abs (Hl) ,hz,abs(H2)),... title('Comparison of FIR’ and IIR Filters'),... xdabel ( ‘Hertz'), ylabel ("Magnitude"), grid 10.21 % This filter compares a Butterworth filter to an FIR filter. 9600; £s/2; L/fs; N= 8; wn = [300/fn 4000/fn) ; [B1,A1] = butter (N,wn) ; % N = 32; £= [0 0.03 0.1 0.8 0.9 1); m=(0 0 2 2 0 01; 2 = remez(N, £,m) ; op (H1,wr] = freqz(B1,A1,100) ; [a2,wr] = freqz (B2,1, 100) ; hz = w1/(2*pi*T); 8 plot (hz, abs (H1) ,hz, abs (H2)),... ‘title( ‘Comparison of FIR’ and IIR Filters'),.. xlabel (‘Hertz’), ylabel (‘vagnitude') ,grid 53 Engineering Problem Solving with MATLAB, Second Edition by Delores M. Etter 10.22 ‘This program compares an elliptic filter to a & Yule-Walker filter. [500/£n 1000/£n) ; [B1,Al] = ellip(N/2,2p,Rs,wn, ‘stop'); 0.07 0.12 0.18 0.25 11; Loo 9 aa; yulewalk(, £m) ; = fregz (B1,A1,100); (H2,wt] = freqz(B2,A2,100) ; hz 2 wI/(2*pi"T); & plot (hz, abs (HL) ,hz,abs(H2)), title( "Comparison of Two IIR Filters'),... xdabel ( ‘Hertz') ,ylabel ( Magnitude") , grid’ 10.23 This program compares a Remez filter to a Yule-Walker filter. & 2500; £s/2; 43; [0 0.02 0.09 0.1 0.2 0.38 0.42 0.46 0.5 11; m=(1l 0 0 2 2 0 060 4 4; (B1,A1] = remez(N,f,m) ; (B2,A2] = yulewalk(N/4,£,m); a (HL,wE] = freqz (B1,A1,100) ; (H2;wE] = freqz (B2,A2,100) ; hz = w0/(2*pirt) ; ® plot (hz, abs (#1) ,hz, abs (H2)),..- title(*Comparison of Two IIR Filters’), xlabel (‘Hertz') ,ylabel (‘Magnitude’) ,grid 54 Engineering Problem Solving with MATLAB, Second Edition by Delores M. Etter 10.24 & This program compares different order elliptic filters & 9600; £5/2; 1/Es; 20; 900/fn; (B1,A1] = ellip(6,Rp,Rs,wn, ‘high') ; (B2,A2) = ellip(8,Rp,Rs,wa, ‘high') ; [83,83] = ellip(10,Rp,Rs,wn, 'high'); 3 a (HL,wP1] = freqz (B1,A1,100); (H2,w92] = freqz (B2,A2,100); [83 /wr3)] = freqz(B3,A3,100) ; hal’ = wEl/ (2*pi*T) ; hhz2 = w02/(2*pi*T) ; ha3 = wI3/(2*pi*T) ; & plot (hz1, abs (H1) ,hz2, abs (H2) ,hz3, abs (#3)), - title( ‘Comparison’ of elliptic filters’) xlabel ( ‘Hertz') ,ylabel ("Magnitude") , gri 10.25 % ‘This program compares different order elliptic filters 10000; fs/2 1/fs; R= 20; wn = [1000/£n 3000/£n); tranbandi=1000; tranband2=1000; while(tranbandi>200 | tranband2>200) (B1,a1] = cheby2(N,Rewn); (H,wt] = freqz (B1,A1, 100) ; hz’ = wt/ (2*pi"T) ; tranbandl = hz (min (find (abs (iH) >.7))) -hz (min (ind (abs (H)>.1))) ; tranband2 = hz (max(find (abs (H)>.1)))~ hz (max (find (abs (H)>.7))); Nene end a plot (hz, abs )) ,xlabel ("Hertz") ,ylabel ( Magnitude") ,gria, title("Min. order Cheby 2 filter with 200 Hz tran bands'} Gisp(‘Filter Order:') disp(2*w) 55 Engineering Problem Solving with MATLAB, Second Edition by Delores M. Etter 10.26 10.27 10.28 % ‘This program generates random noise 8 noise = randn(1,1024) *sqrt(1)+.5; £t (noise) vect = 750*{1:522) /512; plot (vect, abs (N(1:512))) ,xLabel (Frequency, Hz"), ... vylabel (‘Magnitude’), title('Magnitude of white noise’) % This program filters white noise with an FIR filter s 1500; £5/2; 1/Es; N= 8; 0.5; 20; wn = 500/£n; [B,A] = ellip(N,Rp,Rs,wn, 'high'); & y = filter (B,A,noise) ; 8 ¥ = fftly); vect = 750*(1:512]/512; & plot (vect, abs (¥(1:512))),title(‘Magnitude of filtered noise’), xdabel ( ‘Frequency, Hz'} ,ylabel (‘Magnitude’) ,grid % ‘This program filters white noise with an FIR filter 8 fs = 1500; fn ? & N= 32; £= [0 0.1 0.2 0.3 0.4 0.5 0.75 0.8 0.9 11; m=(0 0 0 0 0 O 2 2 2° 4y B = remez(N,£,m); & & y = filter(B,1,noise) ; & ¥ = €€t(y); vect = 750*[1:512]/512; & plot (vect, abs (¥(1:512))),title(‘Magnitude of filtered noise'),... xlabel ( ‘Frequency, Hz'} ,ylabel (‘Wagnitude') ,grid 56 Engineering Problem Solving with MATLAB, Second Edition by Delores M. Etter 10.29 § This problem filters a sinusoid using the elliptic filter designed in problem 20 024; 1500; = £8/2; 1/fs; O:n-1; sig = sin(2*pi*SSO*k*T) ; k 5: = 0. 20; = 500/fn; [B1,A1] = ellip(N,Rp,Rs,wn, 'high'); % Bagze y = filter(B1,A1, sig); plot (k, sig, k,y),xlabel(‘pts' title(*550 hz sin versus filtered sin‘) grid % delay = min(find(y>.7) )-min(#ind(sig>.7)); disp( ‘Samples of delay:') disp(delay) 10.30 % This problem filters a sinusoid using the FIR %& filter from problem 20 0.1 0.2 0.3 0.4 0.5 0.75 0.8 0.9 11; (Ot ON Oe 0 Ole te ya) y = filter (B2,1,sig) ; plot (k, sig, k,y) label (‘pts"), ... title('S50 hz sin versus filtered sin'),crid e delay = min(find(y>.7) )-min(find(sig>.7)); disp( ‘Samples of delay:') disp(delay) 37 Engineering Problem Solving with MATLAB, Second Edition by Delores M. Etter Chapter 11 11.1 % ‘This program generates the open-loop Bode plot. & mum = 57*160*conv({1 10}, [1 17]); den = conv({1 0 0],conv({1 1], {1 1701)); (mag, phase, w] =bode (num, den) ; 2 bode (num, den) ,title('Mirror Open-Loop Bode Plot’) & fc = w(min(£ind (mag<1) )) ; margin = abs (phase (min (find (mag<1) )))~pi/2; s isp( ‘Crossover Frequency (rps! disp(fc) isp('Phase Margin (r):') disp(margin 11.2. & This program generates the Nyquist and Nichols plots. & num = $7*160*conv( [1 10], {1 17]); den = conv([1 0 0J,conv({i 1], [1 170])); Imag, phase] = bode (num, den) ; & subplot (2, 1,1) ,nyguist (num,den) ,axis({-10 0 -2 2]),grid,... title('Mirror Open-Loop Nyquist Plot'),axis('square'),.. subplot (2, 1,2) ,plot (phase, 20*1og10 (mag) ) ,grid, ... title('Open-Loop Nichols Plot'),... xdabel('Phase (deg) '),ylabel (‘Gain (48) ') 11.3% This program computes the closed-loop transfer function and generates the Bode plot from which the bandwidth can be determined. peere 1 = 57*160*conv({1 10}, [1 17]); 1 = conv({1 0 0},conv({1 1], {1 170])); n2=1; a2 =1; 8 den = convin.1,d2); [0 0 convini,n2)] + conv(d1,42); Logspace (3, 3/1000) ; (mag,phase] = bode(num,den,w) ; s subplot (2,1, 1) ,semilogx(w/ (2*pi) ,20*log10(mag)),... title('Mirror Closed-Loop Bode Plot xlabel (‘Frequency (Hz)") ,ylabel ‘Gain’ (a3) '), grid, subplot (2,1, 2) ,semiloge(w/ (2*pi) ,phase) ,... xdabel (‘Frequency (Hz)'),ylabel (‘Phase (deg) '),grid ® clbandwidth = w(min (find (20*10g10 (mag) <-3))) disp (‘Closed-Loop Bandwidth (rps) :') disp (clbandwidth) 58 Engineering Problem Solving with MATLAB, Second Edition by Delores M. Etter 1.4 11.5 % This program plots the closed-loop step response from which the % peak overshoct and the settling time can be determined. 8 nl = 57*160*conv({1 10], [1 171); AA = conv({1 0 0},conv({1 1], {1 170])); n2=1; a2=1; s num = conv(n_1,d_2) ; den = [0 0 conv(ni,n2)} + conv(di,d2); ® [y,x, t] =step (num, den) ; 2 step (nun, den), title(‘Mirror Closed-Loop Step Response’) ,grid s peak_overshoot = 100*(max(y)-y(length(y) ))/y(length(y)}; final = y(length(y)); max_y = find(y==max(y)); findy = maxy + min(find(y(max_y:length(y))<(1.05*final) & ... y(max_y: length (y) )>(.95*£inal) }) set_time = t(find_y); disp('Peak Overshoot: disp (peak_overshoot) disp('Settling Time (s) disp(set_time) % ‘Thi program converts the closed-loop transfer function to % state-space equations and generates the Bode and step response % plots. The results are the same as in problens 3 and 4. & nL = $7*160*conv( [1 10], [1 17]); Qi = conv([1 0 0},conv({1 1], {1 170])); n2=l; 42 =1; num = conv(n_1,d2); = [0 0 convini,n2)} + convidt,d2); [a,b,c,d] = t£2ss(num den) ; (mag, phase,w] = bode(a,b, c,d) ; & subplot (2, 1,1) , semi logx(w/ (2*pi) ,20*L0g10 (mag) ) title (‘itirror Closed-Loop Bode Plot'),... xlabel (‘Frequency (Hz)'),ylabel ('Gain’ (a3) "),grid, subplot (2, 1,2) ,semiloge(w/ (2*pi) phase) ,.. xlabel ("Frequency (Hz) '),ylabel("Phase’ (deg) ") ,grid,pause step(a,b,,d) ,title( Mirror Closed-Loop Step Response") ,grid & (y.x, tl=step(a,b, c,d); peak_overshoot’ = 100* (max (y) ~y (Length (y) )} /y (length (y) ) + ‘Sinal = y(eageh(y))s ind (y==max (y) ); ‘Find y = macy + min(£ind(y (max y:length(y) )<(1.05¢final) & ... y(maxc_y: length (y) )>(.95*£inal)}) set_time = t(findy); disp( "Peak Overshoot disp (peak_overshoot) disp( ‘Settling Time (s):') disp(set_time) 59 Engineering Problem Solving with MATLAB, Second Edition by Delores M. Etter 11.6 1.7 1.8 11.9 11.10 % ‘The following statements convert transfer function (a) to 8 zero-pole-gain form: a num = 10*13 11; den = [170 1200); & disp('Zero-Pole-Gain Form:') [z,p,k] = t£22p(num, den) & ‘The following statements convert transfer function (b) to % zero-pole-gain form: 8 mum = [1 1]; den = conv({1 0],conv({1 2], {1 4 8))); & isp(‘Zero-Pole-Gain Form: [z.p,k] = t£2zp(num, den) & ‘The following statements convert transfer function (a) to & partial fraction form: 8 num = 10*(3 1); den = [170120 0}; e isp( ‘Partial Fraction Form: [r,p,k] = residue (num, den) % ‘The following statements convert transfer function (c) to % partial fraction form: s num = 15*{1 1 10); den = [1 6 10]; & disp( ‘Partial Fraction Form:') [z,p/k] = residue (num, den) The following statements convert continuous-time state-space equations (e) to discrete-time equations using a sample period of 0.1 seconds. [o 1 0 o 0 4 ~6 -11 -6); fo 0 4)" www e b 8 isp( ‘Discrete-Time Form:') [ad,ba] = e2d(a,b, -1) Engineering Problem Solving with MATLAB, Second Edition by Delores M. Etter q.a1 1.12 11.13 qa % ‘The following statements convert transfer function (a) to & state-space and to partial fraction forms: s nun = 3; den = [1 6 11 6); & disp('State-Space Form:') [a/b,c,d] = t£2ss (num, den) disp( "Partial Fraction Form: [r,p/k] = residue (num, den) % The following statements convert the state-space form (e) to % transfer function form: 2 aA even disp( ‘Transfer Function Form:') {num,den} = ss2tf(A,B,C,D,1) % ‘The following statements convert state-space equations (e) to % zero-pole-gain form and then back to state-space form: & A=[0 10 o ol 26 -11 -61; B= 004)"; c= [1001; D = (0); % disp 'Zero-Pole-Gain Form: [2/p/k] = s822p(A,B,C,D, 1) disp('State-Space Forn:') [a,b,¢,d] = zp2ss(z,p,k) % ‘The following statements convert state-space equations (e) to % zero-pole-gain form and then to transfer function form: ® A=[0 10 o 01 6 -11 -6); = 00 4)"; {2 0 0}; = (01; eoom disp('Zero-Pole-Gain Form: [z,p,k] = ss2zp(A,B,C,D,1) isp( "Transfer Function’ Form: ") [num,den} = 2p2t£(z,p,k) 61 Engineering Problem Solving with MATLAB, Second Edition by Delores M. Eiter 11.15 11.16 11.17 % ‘The following statements convert the state-space equations of % problem 13 to transfer function form: a a= [-1.0000 0 ° 1.0000 -5.0000 -2.4495 a 2.4495 0]; {10 0)"; [0 0 1.6330); 0; b c a S isp( ‘Transfer Function Form: ") [num,den} = ss2tf(a,b,c,d,1) % ‘This program generates the Bode and Nyquist plots for (a) using % right-side arguments. a num = 10*[3 1]; den = [170 120 0]; % bode (num, den), title('Bode Plot’) ,pause nyquist (num, den) , axis({-20 20 -20 20]),... title('Nyguist Plot"), grid % This program generates the Bode and Nyquist plots for (b) using % left and right side arguments and a user specified frequency & range. s num = [1 1]; conv([1 0],conv({1 21, {1 4 8])); neinput (‘Input starting/ending values for n where w = 10*n: ') w = logspace(n(1),n(2)); & (mag,phase,w] = bode(num,den,w) ; & subplot (2,1,1) , semilogie(w,20*log10 (mag) ),title(*Bode Plot), .. xlabel('Frequency (rad/sec) '),ylabel(‘Gain (4B)*), grid, subplot (2,1,2), semilogx(w, phase) , grid, xlabel (‘Frequency (rad/sec)');ylabel (‘Phase (deg) '),pause & [xe,im,w] = nyquist (num,den,w) ; plot (re, im, xe,—im, "--') ,titie( ‘Nyquist Plot'),... xlabél (‘Real Axis’), ylabel(*Tnag Axis) erid 62 Engineering Problem Solving with MATLAB, Second Edition by Delores M. Etter 11.21 $ This program generates the root locus plot for (c) using % left-side arguments, user-specified gains, and x's to mark pole % locations. & num = 15*[1 1 10); den = [1 6 101; n=input (‘Input values of n where gain = 10% k = logspace(n(1),n(2)); & (x/k] = rlocus (num, den, k) ; a plot(r, 'x'), title('Root Locus Plot’), .. xdabel ("Real") ,ylabel ("Imag") grid 11.22 % ‘This program generates the root locus plots for (a) using % transfer function and state-space equations. o*13 4); (17012001; k = logspace(-1,4); & rlocus (num, den, k) ,pause 2 [a,b,c,d] = t£2ss(num,den) ; rlocus(a,b,c,4,k) 11.23 & ‘This program converts (b) to state-space equations and % generates the root locus plot using left-side arguments and & user-specified gains. 8 mum = [1 1]; den = conv([1_0],conv({1 2], {1 4 8])); [a,b,c,d] = t£2ss(num, den) ; input (‘Input values’ of n where gain = 10"n: ‘logspace(n(1) ;n(2)); k g [x,k] = rlocus(a,b,c,d,k); 2 plot (r),title('Root Locus Plot'),.. xdabel (*Real') ,ylabel (‘Imag') ,grid ‘Transparency # TM-1 TM-2 T™M3 T™M4 TM-5 T™M-6 ™M7 ™-8 ™-9 TM-10 TM-I1 TM-12 TM-13 TM-14 TM-15 TM-16 TM-I7 TM-18 TM-19 TM-20 M21 'TM-22 'TM-23 ‘TM-24 ™M-25 M26 ™-27 ‘TM-28 ™29 ™-30 TM-31 TM-32 TM-33 TM34 M35, TM-36 M37 TM-38 T™-39 T™-40 TM-41 TM-42 T™-43 TM-44 TRANSPARENCY MASTERS by Delores M. Etter Caption Internal organization of a computer Software interface to the computer Comparison of software statements Program compilation/linking/execution Software life cycle phases Numeric display formats Simple plots of distances for 10 trials Enhanced plot of distances for 10 trials Arithmetic operations between two scalars Element-by-element operations Precedence of arithmetic operations Linear and logarithmic plots Graph with two functions Line and mark options Arithmetic operations with complex numbers Complex plane Polar plot with increasing radius ‘Three-dimensional function Mesh plot of a function of two variables Surface plot of a function of two variables Contour plot of a function of two variables Mesb/contour plot of a function of two variables Random sequences Histograms with 25 bins Relational operators Logical operators ‘Combinations of logical operators Two lines Two planes Three distinct planes ‘Three distinct planes (continued) Linear and cubic-spline interpolation Similar triangles Distances between points and linear estimates Least-squares linear regression Polynomial fits Integral of f(x) from ato b Derivative of f(x) at x=a Example of function with critical points, ‘Techniques for computing f'(x,) Computation of y, using first-order Runge-Kutta Computation of y, using first-order Runge-Kutta Analog and digital signals Effects of filters on sinusoids Table 3.3 Table 3.4 Fig. 5.1 Fig. 5.2 Fig. 5.3 Fig. 5.3 ™M-45 ™M-46 ‘TM-47 TM-48 TM-49 T™M-50 Ideal transfer functions Typical lowpass filter Spring-mass-damper system Plant model and measurement model Model conversion functions Design and analysis functions Table 11.1 Table 11.2 yeusy yndino on eVIMW ule Banos worgig Buneeneuy yndu Ado | | 1 1 | | 1 1 | | LI nv — | | | | po | | ' JOSsa001q | eee 4c-ccccncHr >-- a Al 7 Asowouw Asowau jewieyxy jeuseyu| deyndwios e jo uoeziueBso jeusazuy 4 -} “B14 iL TM-2 Fig. 1.3 Software interface to the computer (© 1088 by Prenice-al, no. Engeering Problem Solving with MATLAB, 2/¢ | Simon & Schutt Visom Company by Ours Mena Upper Sac iver New lrsey 07438 en eM wie Banos wor “(@/ze,eEWeTP) x (Z/TSISWETP) xEESTHT°E = Pete Sgnduoo TOUOD (Z/P) «(Z/P) xE6STOT"E = © IST DIsva (Z/zeqeueTp) x (Z/TOIOWETP) xEGSTPT°E =? vOrTe Teoseg ‘xx (Z/TOIUETP) xECSTHT°E =? wore epyv Zxx(0°7/TOISWETP) xEESTHT“E = eOTe UeIWIO] ‘(@/ze euetp) »(Z/TSIOUETP) +xEGSTHT°E = wore +4+9'O ‘(fv (@/ze3ewWe Tp) )xTA = vere aVILV SJUSWE}e}S BIEMYOS JO UOSeEdWOD 4} BIGeL e-W. iL fexauog unseen Wer ooo fe en eV AM uM Bares word uoynoexy Buipeoy / Buryury uoneliduwog yndjno peol uresBoud wesBod weBoig * | N98 yyqun ebenbue ~ eaidwog K— aBenBue| 9 7 eulyoeyy eyep indu| uonnsexe /Burjuy /uoneydwos wesBoig p-} “B14 PW evr ivi wes Banos word Bunsen %09 aouReUNJUTeYT %Q SuTsay, payersaquy PL Susay, repo pure Surpo> %SL uoyeotioadg YE UOTTUTAC] soseyd a0A9 ay] aIeMYOS =z} aIGeL S-WL en eM wie Banos wor + yueygq ‘— ‘+ + JeuZ0Z TO+SEEEEEEEEEESHETS'T — speumDap GT © BuotT yewz0F TO+S8SEZS*T sjeumep F ® 4z0Yys JeUIOF €Z°ST sjeumdep Z yueq jeuUZ0F E€EEEEELEESHET'ST — S[eUTDap FT Huot 3eur0; SPEZ*ST ynejep qz0ys yeuz0; syewoy Aejdsip 94eWNN 1'Z eIGeL aor arco Keer men von apes 9 21a Wssi9%0 fa fezeiiog unseraeienes # uous Y en OAM we Banos worgig Bunny ‘Wen coun Ae Boe 2 SIELR OL 10} Seoue;sip Jo yo] aids 4'Z “B14 “WL garZo Kesar MeN vty apps ec 21a Wssi9%0 fa fezeiiog unseraeienes # uous Y en OAM we Banos worgig Bunny ‘Wen coun Ae Boe 2 SIEM} OF 40) seoueysip jo yojd peoueyug Zz “614 SW yeusy en OAM we Banos worgig Bunny ave q? uoyeyusuodxe qe a UOISIAIp qe qxov uoyeoydyynur q-e q-v uojoeygns ae q+0 uoHTppe suejeos OM) UBEMyeq SUOHeIedo OHEWUY Z'Z e1geL 6-WL garZo Kesar MeN vty apps ec op 7 OUSy evr ivi wes Banos word Bunsen ave q? uonerueuodxe qe 4 UOISTATp ase qxo uonestdyjnur q-e q-—v uonoeygns aie q+v uonTppe suonesedo yuewaja-Aq-juewe|, °Z aIGeL OL-WWL yeusy en OAM we Banos worgig Bunny YS 0} 12] ‘UOOeAQns pue uoyIppe YSU 0} 12] ‘UOISLAIP pue uoyeoT[dyynur JUYBII 04 Ya] ‘UoHeUsUOdxa }sJ1j JSOULIOUUT ‘sasayyuared maNO Ht suonesedo sjawyye yo a.Uepedalg = 7'Z BIGEL LEIA arco Keer men von apes 9 fexauog unseaveienes # uous Y ‘Wen coun Ae Boe 2 syojd o1wiyyseGo] pue weoury = Ez “B14 en OAM we Banos worgig Bunny ZL-INL evr ivi wes Banos word Bunsen ‘Wen coun Ae Boe 2 suojouny omy YM Yyde1y 9° “BIS ELIA yeusy evr ivi wes Banos word Bunsen ox + yreur-x apr - Tes : snjd - yuiod - jop-ysep panop poysep pros suoydo yuew pue auly ¢'z aqeL, PLN en OAM we Banos worgig Bunny cong Kage (q+ % = % pur 'qi + 'v = '9 yey} eumssy) (49 yo aye8n{uoo) 'qr — 'v (19 Jo anqea aynjosqe Jo apnyruseuw) Zid + VA qt cu 74 t+ 2v Teg — Gru) * \Fqhq + ay ('q% + “qlo)t + (%q'q — “vlv) (%q — 'at + (So — to) (74 + 'at + (@ + 0) saequinu xajdwoo ym suojesedo onewIAY LE aIqeL SI-WL TM-16 Fig. 3.1 Complex plane imaginary axis 38+ 24 t+ +—+— 8 (2, 3) = (a, b) 7—_+—_+—_+—_+——__ real axis 1 2 3 4 TM-17 Fig. 3.2 Polar plot with increasing radius Polar Plot 90, 120 ~—— 60 180 0 270 1908 by Prentice Hl, re. Engimering Problem Sovng wih MATLAB, 2'¢ Asinan &Sonun/ecan Company Ee" Sede Fever, New sersoy O74S8 TM-18 Fig.3.5 Three-dimensional function arco Keer men von apes 9 28 sto" fa Rixduep oom avesnieg @ OS Y 27 INH He Banos woyeig BUNDLES 10ld UseWy S@]QeLUEA OMY JO UOOUNY e yO yO]d ysaW 9"e “BIG, 6L-INL arco Keer men von apes 9 na ouch Rixduep oom avesnieg @ OS Y en OAM we Banos worgig Bunny jO]d eoepNS S2|GELEA OM} Jo UOROUNY e 40 3O]d BdeyINS Z'E “Bd O2-WL arco Keer men von apes 9 21a Wssi9%0 fa fezeiiog unseraeienes # uous Y en OAM we Banos worgig Bunny ‘Wen coun Ae Boe 2 SOIGELIEA OMY JO UOROUNY e JO JO] sNoyUOD gg “BI LZ-WWL arco Keer men von apes 9 -axa eso fa Rixduep oom avesnieg @ OS Y 2 uMi iM Banos word Bunny ie ee a eee zo ya JO|q ANOJUOD/YSeyy S9IGELEA OMY JO UOROUNY e 40 jO)d NOUOD/YSEW G'E “BIA 2e-WNL gsr fener man as apes cr a wesoe ka ‘itauiog uoom yams, 9 HOS #2 ar uMn ai Buns wee ume 3 x@pU] 00g osp O0r ose 00€ ose 00% ost OOF og 9 padi Ze1ep - Siaquiny wopueY, 00g osy OOP ose 00e ose 002 ost OOF os % Be WA MO LG 1" e1ep - Suequuiny wopuey sgouanbas wopuey O1'€ “Bid €2-WL arco Keer men von apes 9 21a Wssi9%0 fa fei Kom men ats eg ce evr ivi wes Banos word Bunsen ‘Wen coun Ae Boe 2 suiq oz YM swesBo}sIH ZL "e “BI 2-INL evr ivi wes Banos word Bunsen [enba jou =~ yenba == [enba 10 uey} saye013 =< uey} Joyeo13 < [enba 10 uey} sso] uey} Ss2y > suojeiado jeuonejay = Z"€ e1geL SZ-WL saoyesedo je91607, en eV AM uM Bares word 40 puv jou ee sgeL 9Z-WL en OAM we Banos worgig Bunny any any as[ey any any asyey any as[ey asyey any as[ey ony any any asyey as[ey as[ey any as[ey as[ey ssoyesodo jeo16o] yo suoneuiquog pe e1qe) Le-WWL TM-28 Fig. 5.1 Two lines Point of &— intersection A, Ip (b) (oc) © 1908 by Prenion-a ns Engineering Problem Solving wth MATLAB, 2/6 Simon & Schust Viacom Company by Delores M Ener Upper Sethe Fver, New erey O48 en OAM we Banos worgig Bunny Were como fe Bo (0) (a) (e) sourjd om, 2°¢ “Bid 62-INL TM-30 5.3 Three distinct planes < x Point of intersection Line of intersection (b) y (© © 1006 by Prentice Engineering Problem Solving wth MATLAB, 2/6 -ASinon & SchustatVisom O by Delores M Ener Upper SecheFver, New ey TM-31 Fig. 5.3 Three distinct planes (continued) © 1906 by Prentice by Dolores M Ener Upper Sache Fover, New dese arco Keer men von apes 9 el ceceael fexauog unseaveienes # uous Y en OAM we Banos worgig Bunny co weprsouuais A2 Bast 2 uonejodsezuy euljds-o1qno pue weeury 9 “B15, Ze-WL en OAM we Banos worgig Bunny Ei Oe ed (9)s—(e)s (q)s —(2)4 sejbueny seis "9 “B14 iL arco Keer men von apes 9 21a Wssi9%0 fa fezeiiog unseraeienes # uous Y en OAM we Banos worgig Bunny ‘Wen coun Ae Boe 2 ‘$9}eUI}S9 ABaUT| Pue S}UIOd UBEMjeq SeoURysIg 9°9 “6. vE-INL arco Keer men von apes 9 nia weuona fa fexauog unseaveienes # uous Y evr ivi wes Banos word Bunsen ‘Wen coun Ae Boe 2 uolssesBe seeul| Sosenbs-yseo7 = 2°9 “B14 Se-WL arco Keer men von apes 9 21a Wssi9%0 fa Rixduep oom avesnieg @ OS Y en OAM we Banos worgig Bunny "24 "wronunng fe 2661 2 syy [elwoufjog "9 “B14 9 (qs pws” f egy gop woy (x)j 40 }exBayuy 4-2 “B14 Le-WL en eM wie Banos wor e=x}e(xyyooaneaeg 9°2 “B14 en OAM we Banos worgig Bunny wnuwiulw |290| wnwixew |e00| Syulod JeoRL YYW UOOUNY jo aidwexy 12 “B14 6E-INL (0) (4) Ly ty by by ty by | | 1 4 1 | (1 -%x)4 Cix)s eix)y (tx)y (9x), (7 9x)4 (*x)4 Buyndwos 40} sanbiuysay = g*z “614 en OAM we Banos worgig Bunny (e) by Oy by + t t (F%x)4 (tx)s (1 *%x)s Ob-INLL TM-41 Fig. 8.1 Computation of y,, using first-order Runge-Kutta Ya TM-42 Fig. 8.2 Computation of y, using first-order Runge-Kutta Ya arco Keer men von apes 9 21a Wssi9%0 fa fexauog unseaveienes # uous Y en OAM we Banos worgig Bunny ‘Wen coun Ae Boe 2 sjeuBis jey61p pue Bojeuy 01 “Bi er-WL JoyI4 rey6iq (9+0+14°M)UISg-Y (9+ 14 °@)ulsy J9yI4 0, Bojeuy (9+)°@)uIsy (0+9+) °)ulsg-V SplOsnuls UO S193] 40 $9943 901 “Bld bb TM-45, Fig. 10.7 Ideal transfer functions Lowpass Hz Bandpass Hz Highpass Bandstop evr ivi wes Banos word Bunsen pueqdojs pueg uonisues} puegssed LO go |x| 20 OL Joyy ssedmoj jeoidhy 8°01 “64 9p-WL ep eavi wie Banos: OM ==] [1 (ijn ~~ wi QQQ00 wa3sfs sedwep-ssew-Buuds = "44 “614 Lb-WL e+sp+.s (s)A 3 (s)x L (s)n JUsWAaINSea/| yueId Japow yuswesnseow pue japow juejq = Z"hb “Bld Sb-WL en OAM we Banos worgig Bunny uoyouny Jaysuey 0} ure8-ajod-o190z gazdz aoeds-a}e}s 0} ute8-ajod-o1ez sszdz ute8-ajod-o1ez 0} uoTIUNy Jaysuey} dzz3z3 aovds-a}x}s 0} UOTUNJ JoysuLIy ssz733 ure8-ajod-o1az 0} adeds-aye}s dzzss uopouny Jaysuen 0} a0eds-aye}s zazss uotsuedxa uonoey-yensed enptsez aoeds-a}e}$ a]a19SIp 0} adeds-a}e}s snonunUOD pzo SUONOUNY UOISJAUOD [POW ELL PIGEL 6b-WL asuodsar au days-yrun yord snd0]-j0o1 suvagq yo[d asuodsar-Aduanbayy ystnbAN sjojd asuodsai-Aduanbay aseyd pure apnyrusew dejs snooTa astnbAu epoq suoouny sisfjeue pue ublseq ZL a1geL OS-IWL

You might also like