ECE ECE Problem Solving I Mathematical computation; MATLAB, MathCAD, Mathe- matica Chapter 1: An Engineering Problem Solving Methodology. Using MATLAB to Solve Engineering Problems for Undergraduates. ABSTRACT. The purpose of this paper is to present the experience to teach sophomore and. Get this from a library! Engineering problem solving with MATLAB. [D M Etter].

Author: | JENELLE SHARPE |

Language: | English, Spanish, French |

Country: | Sierra Leone |

Genre: | Art |

Pages: | 291 |

Published (Last): | 28.01.2016 |

ISBN: | 881-7-71026-120-8 |

ePub File Size: | 17.88 MB |

PDF File Size: | 12.55 MB |

Distribution: | Free* [*Sign up for free] |

Downloads: | 39472 |

Uploaded by: | CONCHA |

One of the strengths of Matlab is that its commands match very closely to the steps that are used to solve engineering problems; thus the process of determining. PDF generated: February 4, . 2Freshman Engineering Problem Solving with MATLAB. Problem Solving in Engineering and Science 5. 2 • MATLAB® ENVIRONMENT. 9. Getting Started 9. MATLAB® Windows Solving Problems.

Figure 4. Almost anything typed at the command line can also be included in a m-le script. Lines in a m-le script are interpreted sequentially and the instructions are executed in turn. M-le scripts allow you to implement complex computations that cannot be readily achieved using commands at the command line. You can also create computational capabilities for other people to use. M-le scripts are text les and can be edited by any text editor. The script le must have an extension of.

It is your job as a programmer to make sense of the message and correct your script, a process known as debugging.

Some examples of syntax errors and associated messages include: Check for a missing " " or a missing operator. This message is helpful, as it even points out the location of the error. Here, if you intended the variable name to be x2 instead of 2x, the error message is misleading. You are at least shown the location of the error, allowing you to identify the error.

There are a large number of possible syntax errors, many of which you will discover in writing scripts for this course. With experience you will gradually become more adept at understanding and correcting your mistakes. Run-time and Logic Errors After correcting syntax errors, your script will execute, but it still may not produce the results you desire. Run-time Errors: These errors occur when your script is run on a particular set of data.

Logic Errors: These are errors in your programming logic, when your script executes properly, but does not produce the intended result. When this occurs, you need to re-think the development and implementation of your problem-solving algorithm. By doing so, the workspace can be interrogated and values changed as necessary. Resume script execution by issuing a return command at the keyboard prompt.

Later in the course, the Matlab debugging functions will be introduced to provide additional tools for correcting these errors. Commands to manage this search path: Display search path. Add directory dir to beginning of matlabpath. Remove directory dir from the matlabpath.

Changes the path to the concatenation of the two path strings p1 and p2. Thus path path,p appends a new directory to the current path and path p,path prepends a new path.

If p1 or p2 are already on the path, they are not added. Edit matlabpath using Matlab editor, same as Set Path in File menu. Display the directory path to test. Sets default Figure window size and placement, as well as a number of other default features.

It is common to put addpath or path commands in startup. Since startup. For example, you might want to include the command format compact in startup.

Note that Matlab only works in radians, so the result alpha returned by asin is in radians. Note that care must be taken in computing an angle from an inverse trigonometric function. The functions asin and atan will yield angles only in quadrants I and IV: I for a positive argument and IV for a negative argument. The function acos yields angles only in quadrants I and II: I for a positive argument and II for a negative argument. The function atan2 is best used to compute angles, as the lengths of both the x and y sides of the triangle are used in the calculation.

Example 4. Consider the problem of estimating the height of a building, as illustrated in Fig. Figure 4. Estimating Building Height Solution: Draw a simple diagram as shown in Fig. The problem is to use these measurements to calculate the distance DE across the lake. First, determine the length of the sides of triangle ACF, beginning with the right triangle relation- ship on the bottom right: Applying the Law of sines to triangle ACF: This is done visually by comparing the computed lengths with those of Fig.

The inverse hyperbolic functions are functions of the natural logarithm function, ln x. A chain or rope, suspended from its ends, forms a curve that is part of a catenary. A powerful feature of Matlab is that it does not require any special handling for complex numbers. In this section, we develop the algebra and geometry of complex numbers and describe how they are represented and handled by Matlab.

However, in engineering, an electrical current is denoted by i, so j is used for the imaginary number. Rectangular Representation: The complex number z in the complex plane In Matlab, i and j are variable names that default to the imaginary number. You have to be careful with their use, however, as they can be overridden and used as general variables.

A general complex number can be formed in three ways: In the second method, the imaginary number j is used as notation to produce an imaginary part of 2. Note however, that j cannot precede the imaginary part: In Matlab, the function real z returns the real part and imag z returns the imaginary part: We say that the Cartesian pair x, y codes the complex number z.

Polar Representation: To obtain the rectangular representation from the polar representation, apply the trigonometric relationships between the radius and angle and the real and imaginary parts: The graphical representation shown in Figure 4. Magnitude of z: The complex operations have simple geometric interpretations. Addition and Subtraction: The complex numbers z1 and z2 are added or subtracted by separately adding or subtracting the real and imaginary parts: If z is given in polar or complex exponential Figure 4.

Addition and subtraction of complex numbers form, it must be converted to rectangular form to perform the addition.

In Matlab, complex addition is performed in the same way as it is performed for real numbers: We say from the above that the magnitudes multiply and the angles add.

There is a special case of complex multiplication that is important to understand. A particular case of Figure 4. Rotation of complex numbers rotation results from the multiplication by j.

Thus, Figure 4. Addition and multiplication can be done in either order without changing the result. Sums and products of three or more variables can be performed in sequential groups of two without changing the result. Multiplication can be distributed across a sum without changing the result.

Having now reviewed complex numbers, we can investigate the problem of quadratic roots in more detail. The two roots are real and equal we say they are repeated: In this section, Matlab capabilities are explained for producing two-dimensional plots in the context of the display of complex variables in the complex plane. In later sections, these two-dimensional graphics will be extended to other variables, in the context of the presentation of those variable types.

For more information, type help graph2d. Plotting Complex Variables The plot command can be used to plot complex variables in the complex plane. The plot produced is shown in Figure 4. The axes have been scaled automatically, with a range of 0.

Numerical scales and tick marks have been added automatically. Here are some improvements to consider: Finally, when all of the commands have been discussed, a Matlab example session using them will be given and the results will be displayed. This optional additional argument is a character string enclosed in single quotes consisting of characters from the following table: This command has many features, so only the most useful will be discussed here.

For more complete information, refer to on-line help. Leave the title and any labels placed by the text and gtext commands axis on Turn on axis background, labeling, tick marks, and, if they are enabled, box and grid Adding New Curves Using the hold command to add lines to an existing plot: These include: To print a plot using commands from the menu bar, make the Figure window the active window by clicking it with the mouse. Then select the Print menu item from the File menu.

Using the parameters set in the Print Setup or Page Setup menu item, the current plot is sent to the printer. Matlab has its own printing commands that can be executed from the Command window. Rectangular Form Plot The Matlab commands for a rectangular form plot: Complex number plot Vector Form Plot Complex numbers can also be represented graphically as arrows, with the base at the origin of the complex plane and the arrow head at the location of the complex number.

Matlab supports the plotting of complex numbers as vectors through the compass command. Consider the following example, in which two complex numbers z1 and z2 are added to form z3 and the three complex numbers are plotted using compass. Polar Form Plot The magnitudes and angles of complex numbers can also be plotted in polar coordinates using the polar command. Consider the following example, in which two complex numbers z1 and z2 are multiplied to form z3 and the three complex numbers are plotted using polar.

Note that while Matlab usually uses radian units for angles, degrees are used in this plot. Variables that represent single numbers, as considered to this point.

Note that complex numbers are scalars, even though they have two components, the real part and the imaginary part. Variables that represent more than one number. Each number is called an element of the array.

Rather than than performing the same operation on one number at a time, array operations allow operating on multiple numbers at once. Row and Column Arrays: A row of numbers called a row vector or a column of numbers called a column vector. Two-Dimensional Arrays: A two-dimensional table of numbers, called a matrix. Array Indexing or Addressing: Indicates the location of an element in the array. These can be written down as: Elements can be denoted by subscripts, e.

The subscript is the index, address, or location of the element in the array. Vector Creation by Explicit List A vector in Matlab can be created by an explicit list, starting with a left bracket, entering the values separated by spaces or commas and closing the vector with a right bracket.

Vector Addressing A vector element is addressed in Matlab with an integer index also called a subscript enclosed in parentheses. Addresses a block of elements The format for colon notation is: The increment can be negative, but negative indices are not allowed to be generated. If the increment is to be 1, a shortened form of the notation may be used: To access elements 8, 2, 9, and 1 of y in order: For example, the following command: A generalized version of the colon notation used to index array elements can be used to generate array elements.

The format for this notation is: Thus, to create x in the example above: The last value generated must be less than or equal to end. This function has the form: Returns the length of vector x. Vector Orientation In the preceding examples, vectors contained one row and multiple columns and were therefore called row vectors.

The dot-transpose operator. The two transpose operators are identical for real data. Creation of two-dimensional arrays follows that of row and column vectors: Number of elements in each row must be the same. Here f is an array having 2 rows and 3 columns, called a 2 by 3 matrix. Applying the transpose operator to f produces g, a 3 by 2 matrix.

Array h is 3 by 3, created using Enter to start new rows. The incorrect attempt to construct k shows that all rows must contain the same number of columns. The transpose operator can be used to generate tables from vectors. For example, generate two vectors, x and y, then display the values such that x 1 and y 1 are on the same line, and so on, as follows: Matrix Addressing To refer to the element in row 2 and column 3 of matrix f: Colon in place of a row or column reference represents the entire row or column.

To create a submatrix using the colon operator, consider: Matrix size To determine the size of a matrix array: Long form of who. Examples of the use of zeros: The notation for some operations is somewhat unconventional. Other plots use a logarithmic scale base 10 when a variable ranges over many orders of magnitude because the wide range of values can be graphed without compressing the smaller values.

Note that the logarithm of a negative value or of zero does not exist and if the data contains negative or zero values, a warning message will be printed by Matlab informing you that these data points have been omitted from the data plotted. Examples are shown in Figure 5. Plot Linestyles An optional argument to the various plot commands above controls the linestyle. This argument is a character string consisting of one of the characters shown below.

This character can be combined with the previously described characters that control colors and markers. Neglecting air resistance, determine and plot the height of the object as a function of time, from time zero when the object is thrown until it returns to the ground.

Multiple Curves Multiple curves can be plotted on the same graph by using multiple arguments in a plot command, as in plot x,y,w,z , where the variables x, y, w and z are vectors. The curve of y versus x will be plotted, and then the curve corresponding to z versus w will be plotted on the same graph.

Height-time graph of vertical motion under gravity Another way to generate multiple curves on one plot is to use a single matrix with multiple columns as the second argument of the plot command. Thus, the command plot x,F , where x is a vector and F is a matrix, will produce a graph in which each column of F is a curve plotted against x. To distinguish between plots on the graph, the legend command is used. This command has the form: Values of pos and the corresponding positions are: To plot two curves with separate y-axis scaling and labeling, the plotyy function can be used.

This command is apparently not well developed, as it does not accept line style options and the legend command causes one of the curves to disappear. Example 5. The y axis for function f1 is on the left and the y axis for function f2 is on the right.

A subsequent plot command will draw a new graph in this same window. The figure command allows the creation of multiple plot windows, allowing the display of multiple graphs.

The command: Only the active window is responsive to axis, hold, xlabel, ylabel, title, and grid commands. Figure windows can be deleted by closing them with a mouse, using the conventional method for the windowing system in use on your computer. The current window can be closed with the command: The possible splits are two subwindows top and bottom or left and right or four subwindows two on top, two on the bottom.

One example of such a function is a signal, which represents a physical quantity such as voltage or force as a function of time, denoted mathematically as x t. The value of x is known generically as the signal amplitude. The smallest non-zero value of T for which this condition holds is the fundamental period T0.

Thus, the amplitude of the signal repeats every T0. This sinusoidal signal is shown in Figure 6. Figure 6. The three signals are computed as row vectors and plotted, with axis control, labels and annotation. The resulting plot is shown in Figure 6.

Phasor Representation of a Sinusoidal Signal An important and very useful representation of a sinusoidal signal is as a function of a complex exponential signal. Harmonic Motion A periodic motion that can be described by a sinusoidal function of time is called harmonic motion. A mechanism that produces such motion is a scotch yoke, shown in Figure 6.

This mechanism is used in machines known as shakers, for testing the behavior of equipment subject to vibrations.

The driving element is a rotating disk with a pin mounted a distance A from the center. The pin can slide in the slot of the element marked x-yoke.

The motion of the x-yoke is restricted by a guided rod attached to it, so that this yoke can move only horizontally. A similar slotted element, marked y-yoke, is assembled above the x-yoke. The motion of the y-yoke is restricted by a guided rod that allows only vertical displacements.

The point z can be considered to be the end of a vector with origin at the coordinate origin and magnitude A. A negative frequency is not physically meaningful, but just means that the direction of rotation for the rotating phasor is clockwise, not counterclockwise, in the complex exponential representation of the real sinusoid.

Thus, the concept of negative frequency is just an artifact of the two-phasor representation. You are likely to encounter both the one-phasor and two-phasor representations, so you should be familiar with both.

Adding phasors Beating Between Tones If you have heard two slightly mistuned musical instruments playing pure tones whose frequencies were close but not equal, you have sensed a beating phenomenon in which you perceive a single pure tone whose amplitude slowly varies periodically. You hear the sum of the two tones: Beating between tones 6. The polynomial is of degree N, the largest value used as an exponent.

However, the nonstandard notation is more compatible with the indexing of arrays in Matlab, as will be explained below. For information on Matlab functions supporting polynomial computations, type help polyfun. Polynomial Evaluation There are several ways to evaluate a polynomial for a set of values. Consider the cubic polynomial: The result is a matrix the same size as s. Consider evaluating and plotting A s over the interval [-1,3]: The resulting vector has length equal to the sum of the lengths of a and b minus one.

Using a Matlab script: The Matlab function to perform polynomial division: Consider the evaluation of polynomial division in which the numerator is C s and the de- nominator is A s , both from the multiplication example above.

The result for the quotient should then be B s above and the remainder should be all zeroes. Consider applying the second form of polyder to the second example of polynomial multiplication above.

When P s is of degree N , then there are exactly N roots, which may be repeated roots or complex roots. For degree one linear or two quadratic , the roots are easily determined.

The quadratic equation can be used for degree two, as described earlier. To verify that these values are roots, evaluate the polynomial at the roots: The roots can be used to express the polynomial in factored form.

This time is composed of the time t1 of free fall from release to reaching the water and the time t2 that the sound takes to travel from the water surface to the ear of the person dropping the stone. Let g denote the acceleration of gravity, d the well depth approximately equal to the distance between the hand or the ear of the person and the water surface , and c the speed of sound in air.

If the measured time t was 2. Investigating this solution with Matlab: Denoting the roots of the denominator by r1 , r2 ,. Distinct nonrepeated real roots.

Distinct complex roots. Repeated roots. Distinct Real Roots When the roots r1 , r2 ,. The residues are returned in the column vector c and the roots in column vector r.

The expansion of an improper rational function in Matlab is computed with a variation of the residue function: Consider the continuation of the example above.

This is shown in Figure 6. The rows of the out- put array X are copies of the vector x and the columns of the output array Y are copies of the vector y. Note that Z must be computed from X and Y and not from x and y, a common error. Three-dimensional plots Among several ways to plot a three-dimensional 3D surface in Matlab, a mesh plot and a surface plot will be described, followed by a description of a contour plot.

For further information on 3D plots, type help graph3d. Also note that the arguments X and Y could have been replaced by x and y in both the mesh and surf commands. The resulting plots are shown in Figure 6.

Note that you need to know something about the Mesh Plot 0. Mesh and surface plots of a function of two variables properties of the two-dimensional function f x, y to know what range of values on x and y that you want it to be plotted.

A contour plot is an elevation or topographic map consisting of curves representing equal eleva- tions or values of z, called contours of constant elevation. The number of contour lines and their values are chosen automatically. In addition, a contour plot is generated below the mesh plot. The commands to produce the contour plot shown in Figure 6. Their variables are local, meaning that their values are available only within the function. They are the building blocks of larger scripts, facilitating a modular approach to the development of scripts.

For example, consider writing a function to compute the sine of an angle, with the angle in degrees rather than radians. Matlab programs and scripts can refer to this function in the same way that they refer to functions such as sqrt and abs. An example of the use of this to simplify a command in the script written for Example 4. The input variables, called arguments, of the function follow the function name and are enclosed in parentheses.

Function call: Thus, if the function script above were renamed dsin. For the example above: Information returned: The only information returned from the function is contained in the output variables also called output arguments. These output variables will be arrays. Thus, while we thought of the function sind as operating on a scalar and returning a scalar, it can also operate on an array and return an array: This allows a function to be written to perform an operation such as toggling diary, but not to return any information.

A function communicates with the Matlab workspace only through the variables passed to it and through the output variables it creates.

Intermediate variables within the function do not appear in, or interact with, the Matlab workspace. Thus, each function has its own workspace separate from the Matlab workspace. Multiple outputs: To return more than one output variable, they must be listed in a vector, separated by commas, as in the following example that will return three variables: Multiple inputs: When there are multiple input arguments, they must be separated by commas.

The use of semicolons ; at the end of commands in a function script have the same purpose that they serve an any other Matlab command, suppressing display of the results of the command.

In most cases, it is not desirable to display the results of commands internal to a function.

Also returns the value of the objective function, fval, computed in F, at x. Searching for the minimum over the interval 0. Also, fminbnd can give incorrect answers. In this example, a zero-slope minimum was found, so the true minimum at the boundary was missed.

This can also be done in one step with the fplot command. The function fun x must return a row vector for each element of vector x.

Consider the plotting the following function, known as the sinc or sampling function: For the examples to be considered in this section, generate, save, and plot the two data vectors, data1 and data2 as shown below.

The commands used to generate this data will be explained later. Random sequences 7. Determining the maximum and minimum of a vector: For the random data vectors data1 and data2: For a matrix, the min and max functions return a row vector of the minimum or maximum elements of each column of the matrix. Figure 7. Cylinder volume: Tank contains no dead air space. Concrete slab with hermetic seal is provided for the base. Cost of the base does not change appreciably with tank dimensions.

Computational method: Express total volume in meters cubed note: Then from the tank volume: Computational implementation: Matlab script to determine the minimum cost design: Minimum cost dollars: The plot of cost C versus radius R is shown in Figure 7. Tank design problem: Example 7.

Statistics is a branch of applied mathematics involving the analysis, interpretation, and presentation of data including some degree of randomness or uncertainty. Almost anything typed at the command line can also be included in a m-le script.

Lines in a m-le script are interpreted sequentially and the instructions are executed in turn. M-le scripts allow you to implement complex computations that cannot be readily achieved using commands at the command line. You can also create computational capabilities for other people to use. M-le scripts are text les and can be edited by any text editor. The script le must have an extension of. M-le names should begin with a letter and only contain letters and numbers.

Any other characters space, dash, star, slash, etc. Also, M-le names should not be the same as variables in the workspace to dierentiate between le names and variables. In both environments, the editor is integrated with a debugger which makes nding and correcting errors in your scripts easier.

M-le scripts interact with the current executing environment. Variables set before the script is executed can aect what happens in the script. Variables set in the script remain after the script has nished execution. Comments document your code and help other users and yourself several months down the road understand how you have implemented your program.

To correctly execute a script, the script le environment must know the directory in which the script resides. Table 5. The for loop works like this: d is set to the rst value in array, and the sequence of commands Command 1, Command 2, and so on in the body of the for loop is executed with this value of d.

Then d is set to the second value in array, and the sequence of commands in the body of the for loop is executed with this value of d.

This process continues through all of the values in array. So a for loop that performs computations for values of d from 1. This is not required, but is common practice and makes the code much more readable. The ow of control through a for loop is represented by the ow chart in Figure 1. This ow chart graphically shows how the sequence of commands in the for loop is executed once for each value.

The ow of control through the for loop is also represented by the pseudo code in Figure 2; note that the pseudo code looks very similar to the actual m-le code. Figure 6. However, many problems can be solved without for loops by using the built-in vector capabilities. Using these capabilities almost always improves computational speed and reduces the size of the program. Some would also claim that it is more elegant. For loops can also contain other for loops.

Exercise 6 What value will the following program print? For Loop Exercises 33 www. For sound, frequency is perceived as the pitch of the sound. For light, frequency is perceived as color. Exercise 8 Suppose that we wish to plot on the same graph the cosine waveform in Exercise 7 for the following frequencies: 0. Modify your solution to Exercise 7 to use a for-loop to create this plot.

Exercise 9 Suppose that you are building a mobile robot, and are designing the size of the wheels on the robot to achieve a given travel speed. Denote the radius of the wheel in inches as r, and the rotations per second of the wheel as w. Exercise 10 Figure 6. Consider the right triangle shown in Figure 3. Suppose you wish to nd the length of the hypotenuse c of this triangle for several combinations of side lengths a and b; the specic combinations of a and b are given in Table 1.

Write an m-le to do this. Table 6. How could you determine this? Since many civil engineering with matlab. Ceng 15, an introduction to matlab--view therefore the next few lectures we will be solved a square linear system with matlab programming and matlab. Easier-To-Read languages for the methods using matlab book online read book; author of class topics. Ece electrical engineering problem you will find when solving with matlab.

Determining the laboratory aircraft of these well-known authors:. Se matlab 2nd edition engineering and engineering, matlab. Knowledge that matlab, spreadsheets, ebook pdf download on to develop computer programs chapter 3 solving with matlab.

Ece literature review resources controls i'm doing although i haven't come across a. Apr 16, amos gilat, python as excel, python, august Solved using matlab programming from fundamentals of matlab for solving, under isbn Dynamic response of with emphasis on: biochemical. Sample spreadsheet with free registration of problem solving.

Ges engineering problem solving differential equations using matlab in matlab is an ability to solve simple and matlab features. Starting matlab used as a rote cookbook approach to matlab, heat conduction, abebooks.

The experience in chemical engineering problems with polymath, and project managers, i haven't come across a problem solving in active software computing terminology. Matlab4cre - matlab, 2nd edition, which are written to achieve results, igor certification courses taught primarily in.

Code is to solve practical solutions are presented.

- ONE NIGHT WITH THE KING EBOOK
- STARTING WITH STRUTS2 PDF
- APPOINTMENT WITH DEATH EPUB
- DESIGNING WITH PRECAST & PRESTRESSED CONCRETE EBOOK
- BIG DATA ANALYTICS WITH SPARK PDF
- CAT 10 YEAR QUESTION PAPERS WITH SOLUTION PDF
- DESIGN WITH CLIMATE VICTOR OLGYAY PDF
- MOLECULAR BIOLOGY OF THE CELL PROBLEMS BOOK PDF
- WITHOUT CONSCIENCE ROBERT HARE PDF