# HWs - 1 Alexandra LeSaicherre CHE 2162 TOTAL 103 PTS...

• Homework Help
• 185

This preview shows pages 1–5. Sign up to view the full content.

1 Alexandra LeSaicherre CHE 2162 9/9/15 Homework 3: Problem 1: single () – to change any vector X to single precision. double () – changes any vector X to double precision. str2num () – going from a string matrix to a numeric array. int32 () – takes an integer X and changes it to a signed 32-bit integer. uint16 () – takes an integer X and changes it to a signed 16-bit integer. intmin () – the smallest value an integer can have. dec2base () – takes a decimal based integer and converts it to a base B string. isequal () – numerically equal arrays. real () – intricate real part to X. imag () – intricate imaginary part to X. isreal () – if the array is real it is true. zeros (m) – an m-by-m matrix of zeros. ones (m) – an m-by-m matrix of ones. magic (m) – an m-by-m matrix made up of integers from 1 to m^2. length (A) – gives the length of a vector A. size (A) – gives the size of an array by columns and rows. reshape (A,m,n) – gives a m-by-n matrix taken from the A column. inv (A) – inverse of a square matrix. Problem 2: MfE Problem 3.22 on pg. 119 >> Zl=complex(0,5) Zl = 0.0000 + 5.0000i >> Zc=complex(0,-15) Zc =

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

2 0.0 -15.0000i >> Zr=5+10j Zr = 5.0000 +10.0000i >> R=Zr-5+0j R = 0.0000 +10.0000i >> Zl+Zc+R ans = 0 >> Zt=0 Zt = 0 >> V=complex(10,0) V = 10.0000 + 0.0000i >> V/Zt ans = Inf Problem 3: MfE Problem 2.7 on pg. 56 >> P=220 P = 220 >> n=2 n = 2 >> V=1 V = 1 >> a=5.536
3 a = 5.5360 >> b=0.03049 b = 0.0305 >> R=0.08314472 R = 0.0831 >> (((P+(((n^2)*a)/(V^2)))*(V-(n*b)))/(n*R)) ans = 1.3674e+03 Problem 4: a. Create a row vector variable named rv1 of 12 equally spaced elements in which the first element is 35 and the last element is 10. >> rv1=linspace(35,10,12) rv1 = Columns 1 through 8 35.0000 32.7273 30.4545 28.1818 25.9091 23.6364 21.3636 19.0909 Columns 9 through 12 16.8182 14.5455 12.2727 10.0000 b. Create a row vector rv2 of elements from 4 to 12 spaced by 0.5. >> rv2=[4:0.5:12] rv2 = Columns 1 through 8 4.0000 4.5000 5.0000 5.5000 6.0000 6.5000 7.0000 7.5000 Columns 9 through 16 8.0000 8.5000 9.0000 9.5000 10.0000 10.5000 11.0000 11.5000 Column 17 12.0000 c. Create a row vector rv3 of elements from 4 to 12 spaced by 2.5.

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

4 >> rv3=[4:2.5:12] rv3 = 4.0000 6.5000 9.0000 11.5000 d. What do you notice about the vectors rv2 and rv3? How are they different? Do you think this is calculated correctly? What will you have to be careful of when using this vector definition method? --- What I noticed about the vectors rv2 and rv3 was how rv2 went all the way to 12 and had more numbers in between 4 and 12, so it was more precise. While for rv3 the spacing did not allow it to go all the way to 12. I think they are calculated correctly but because of the spacing of rv3 it did not give me the number I needed. I will have to be careful when using this by making sure that the spacing I choose will still give me the number I want to end with. Problem 5: Create a vector, named Cfirst, in which the first element is 4, the increment is 3 and the last element is 58. Then using the colon symbols, create a new vector, named Csecond, that has six elements. The first three elements are the first three elements of the vector Cfirst, and the last three are the last three elements of Cfirst.
This is the end of the preview. Sign up to access the rest of the document.
• Fall '14
• shelton
• Vector Motors, Alexandra LeSaicherre

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern