ENEL101-Problem set  3 -Chapter 4  Solved                

35.00 $

Category:
Click Category Button to View Your Next Assignment | Homework

You'll get a download link with a: zip solution files instantly, after Payment

Securely Powered by: Secure Checkout Second Badge

Description

Rate this product

 

Please    read     the       file,      “How               to         complete         and      upload             the       solution          template”        before             you         begin.                                                  Download       assign3.m       and      fill        it         in         and      then     upload             the       completed         file       on        D2L     drop    box.                             Also     download       test_assign3.m           and      assign3_solutions.mat    to         test      your    answers          as         you      go.                               Make    sure     your    name               and      UCID    are       correctly    filled    out       in         the       template         file.

The         questions        are       based              on        content           from    chapter           4          of         the       textbook         “MATLAB,       An    introduction               with     applications”.                                     Assume           that     all        the       angles             are       in         radians    except             where             specifically     noted.

Note       for       this      assignment     in         Questions       8-­‐‑10            you      will      need    to         understand     how     to         use      for,         and      end.                 Use                  help     for       

to            get       information    on        how     to         use      the       for       statement.                  You      can      also     type

 

doc         for       

 

on           the       command       line      which              opens              the       document       file.

 

 

 

Do NOT use loops (e.g. for) for questions 1-7

 

 

  1. Given    a               vector                     of             samples                 X1=[ 200, 190,…,10,20]-         -      ,                    determine           the          sum        of           all            of             the

elements       of             the          vector                      X1.

 

 

  1. Given    a               vector                     of             samples                 X2 =[ 200, 190,…,10,20]- - ,        calculate               a               vector                     Y2                      based    on            the          function                 yi = +5 100xi                    where xi                is              the          ith             element                 of X2    and          yi             is           the          ith             element                 of             Y2.                            Make     the          function                return                    Q2 =åsin( )cosxi (yi )             .

i

 

  1. Given    vectors                  of             samples                 X3=[0,1,…,100]            andY3 =[10,11,…,110],              calculate               vector                     æpxi ö+2cosæçæ p ö2 ö

Z3                                           based                       on                                                                    the                     function                 zi = sinèç         ø÷           ççè180ø÷ x yi          i ÷ø÷.                                                                                             xi ,                      yi             and          zi             are          the          ith

180            è

elements       of            X3,          Y3           and         Z3            respectively.

                    

                    

                    

  1. Solve    for           X4           in             the          matrix                    equation               𝐴              𝑋4 = 𝑌4                                  given     é-4 3 1 ù é-2ù

A=êê 5     6          -2úú               and                           Y4 =êê-48.8úú              êë 2     -5      4.5úû         êë 92.5 úû

 

  1. A    rocket                     flying    straight                 up            measures             the          angle     𝜃               with       the          horizon                 at             different               heights,          ℎ.

The                    measured            values                     of             𝜃               and         ℎ               are          stored                    in             two         binary                    data       files        named            Q5h.mat                (contains              a               row        vector                     of             measured            values                     of             ℎ)            and         Q5theta.mat                 (contains              a               row        vector                     of             measured            values                     of             𝜃).                             All           angles          are          in             degrees                 and         height                     is              given     in             𝑘𝑚.

Write               a               Matlab                   function                that        does       the          following:

  1. Reads    the          two         binary                    data       files        and         generates             a               row        vector                     𝑅              whose                    elements                  are          the          estimates             the          radius                     of             the          earth     at             each       data       point     using

𝑅, = 1ℎ−, coscos𝜃𝜃,,

  1. Outputs    the          average                 of             all            of             the          values                     of             𝑅.

 

  1. The    Matlab                  function                rand()                    generates             a               random                 number                 between               0               and                                      Write    a

Matlab            function                that        does       the          following:

  1. Given 𝑀 = 10,000        generate               M             random                 numbers               using     rand(),                   and         store

them         in             a               column                  vector                     of             X.

  1. Computes    the          standard               deviation              (std)      of             the          elements              of             X              using

 

𝑠𝑡𝑑 =

 

and                    outputs                 the          result.                                                         Do           NOT       use          Matlab’s                built-­‐‑in             functions               std()       or           var()      for           this         question.                                 

 

 

 

 

 

  1. A    digital                     magnetometer                   is              a              small     low-­‐‑power    integrated           circuit                     (IC)         that        measures             the           intensity               of             the          earth’s                    magnetic              field       and         produces              digital                     outputs                 that        correspond                    to             the          magnetic              field       intensity               along     two         or            three     axes       of             a               local       coordinate                                               This       electronic          component       is          ubiquitously      used     in          smartphones,    GPS       devices,            vehicles,       airplanes,          etc.       to         produce            accurate            compass            heading             information.

The              measured          values    of         the       earth’s              magnetic           field      (in         nT)        along    the       x           and       y           axes             of         a           magnetometer              are        provided           in          a           binary    data     file        named              Q7xy.mat.                 The       data      file        contains            a

5            by               2           matrix               named              Mdata.                          Write    a           Matlab              function            that      does              the       following:             a.   Reads           the       binary    data      file.

  1. Assigns the       values    of         the       1st         column             of         Mdata              to         row       vector    𝑋7.
  2. Assigns the       values    of         the       2nd        column             of         Mdata              to         row       vector    𝑌7.
  3. Outputs             a           row       vector    𝑍7        whose               elements           are        the       estimates          of         the       relative    compass            heading             from

𝑧, = 𝑎𝑐𝑟𝑡𝑎𝑛   𝑦𝑥,, × 180𝜋

 

 

 

Use for loops to answer questions 8-10.

 

  1. Given    N=10,    determine           the          value     of

 

P           9 𝑄 =

9;Q8;NO

 

  1. Given    M=11,                     determine           the          value     of

 

                                                            :       <Q   =U

𝑄 =  (𝑚 + 𝑛 + 𝑘)

8;U9;QV;9

                    

  1. Given    K=12,    determine           the          value     of

 

W           V              8

𝑄 =

V;Q        8;Q          9;NO

                    

 

  • Assignment-3-px1dm7.zip