Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

EGR 219: Computational Modeling of Engineering Systems (Fall 2023)

Homework Assignment #1 - Part 1

This assignment is worth 100 points and consists of two parts. This is Part 1, which covers MATLAB basics. Part 2 will cover the problem-solving framework and matrices. Both Part  1  and 2  are due Tuesday, September 12th on Canvas. Code must be written in MATLAB, be well documented, and submitted as one M file using sections.

1. Numerically verify the relation below by implementing the expression in MATLAB and using the equality operator to check for equality.

2. Consider the expression below. Implement this expression in MATLAB to calculate A for the following assigned values: x = 0.2, y = −0.1, and z = 0.35. Then, write MATLAB code to answer the following question: is A almost equal to 1/3 within an error of 1.0 or less? For either answer of yes or no, report the amount of error.

3. This problem consists of three parts. (a) Write MATLAB code to generate a column vector of values 0 to 2π in increments of π /10. (b) Repeat part (a) but make the vector a row vector and values  should decrease from 2π to 0 in decrements of π /10. (c) Write MATLAB code to generate a row vector of 100 linearly equally spaced values between 50 and 51.

4. The script below performs operations (i) through (v) but there are some bugs (errors). Retype the code into your M file, and debug it to find all the errors. For each error you find, correct it, and describe each error in a comment. Operations: (i) Create row vector X of values  3, 8, 2, 0.2, -4.3, 3.7, and 9.2. (ii) Create row vector Y where each element of Y is the corresponding element squared of X. (iii) Create row vector Z where each element of   Z is the corresponding element of X divided by the corresponding element of Y. (iv) Subtract each element of Z from the corresponding element of X and save it in X. (v) Display the transpose of X. Hint: Not every line will have an error.

X=3 8 2 0.2 -4.3 3.7 9.2;

Y=X^2;

Z=X/Y

X=X+Z;

disp(X’);