0 Up votes0 Down votes

5 views4 pagesb

Mar 26, 2014

© © All Rights Reserved

PDF, TXT or read online from Scribd

b

© All Rights Reserved

5 views

b

© All Rights Reserved

- (13) Normal Distribution
- Rmsd and Msd
- Chapter 04
- 10_V_Beyond shot retrieval_searching for broadcast news items using language models of concepts
- dc09_west_SAMPLE STATA
- Hwk04 (1).pdf
- Some Solved Questions
- Statistics Review
- Math SL Revision Sheet 2006
- Solutions Chapter03
- uow060546
- may_2010
- 74
- M1-Misc
- Trigonometry
- Comparing Perceptual Noise in Rating Scales
- Programacion con matlab
- Math 60 Sample Final Exam
- MidSem 2013S1 Sol
- Transform and Sinusoidal Funct 11

You are on page 1of 4

Instructions: Create a new directory to the Z-drive of the Computing Centres Windows system and save all files you write during the course into it. Write the code of each exercise into its own mfile as a script. Write all functions into separate files (remember: name of a function = filename!!!). Name the script files like d1e1.m (day 1, exercise 1). To be able to run your own m-files directly from the command window, you must add your directory to Matlabs path or change current working directory.

Data types

1. Structures and cell arrays a) The table below contains some measurements Measurement Filename Time Millisecond Serial Volume Length Value XML2003-01-10.xml 10.1.2003 13:13:46 474 731590.551232337962963 0.662 18.13

Store the measurements into a structure and into a cell array variable and print the variables to the command window. How do these data types differ from each other? b) How will the situation change (or will it?) if there are a lot of measurements (same fields but many values from different time instants)? Save also e.g. the following values in a sensible way to the same structure (a table?) and to a cell array. Below the table there is an example of how the variables cellArray and structure would be like if the data were stored in them. Compare the amounts of memory the variables reserve. Measurement Filename Time Millisecond Serial Volume Length Measurement Filename Time Millisecond Serial Volume Length Value XML2003-01-10.xml 10.1.2003 13:15:42 225 731590.551232337973454 0.552 12.63 Value XML2003-01-11.xml 11.1.2003 08:43:27 912 731590.551232338072548 0.264 15.16

>> cellArray cellArray = {1x3 cell} {1x3 cell} double] [1x3 double] >> structure structure = 1x3 struct array with fields: Filename Time Millisecond Serial Volume Length [1x3 double] [1x3 double] [1x3

2. Write functions for calculating the following statistical quantities. Implement each of the given formulas in its own function without using Matlabs built-in functions. You may, however, use the function sum for adding as well as the functions length, size and sqrt. As an example, apply the functions to the data in the file testData.mat. In the formulas N stands for the number of measurements. a) Average

N

x=

x

i =1

N 1 =

(x x )

i i =1

N 1

(standard deviation)

2 N 1 =

(x x )

i i =1

N 1

(variance)

Compute the average present in the formulas using the function you wrote in item a). Note that in item b) your function must return two values. c) Correlation coefficient

N

r=

( x x )( y y )

i i i =1

(x x ) ( y y )

2 i i i =1 i =1

.

2

In item c) study the correlation of the measurement first qualitatively by plotting the measurements using scatter. See the example figure below.

Interesting data 30

25

20 Second column

15

10

0.5

2.5

d) Write a script that calls all the functions that were written above and prints the results to the command window. Example output:

Measurement 1: average 0.42478, deviation 0.30788, variance 0.094792. Measurement 2: average 13.7338, deviation 5.1712, variance 26.7417. Correlation coefficient of the measurements is 0.84035.

Compare the results given by your functions to those given by Matlabs built-in functions mean, std, var and corrcoef. 3. Write the function xycorr, where you create the variables x and y. The variables are vectors of length 1000. Variable x contains normally distributed random numbers and variable y the sine wave sin(2*pi*50*t), where t is the time vector between 0 1 seconds (choose a suitable sample interval). Add to y also noise that is uniformly distributed on the interval [0, 1]. After creating the variables the function computes the correlation coefficient of variables x and y using the function created in item c) of the previous exercise. Write also a script that calls xycorr 10 times and prints the values returned by the function to the command window. Why are the values that appear to the command window different? 4. Study the forces that affect a body in the origin of a coordinate system (figure below). The magnitude and direction of each distinct force is known, and the resulting total force affecting the body (magnitude and angle) should be computed. The forces are:

F1 F2 F3 F4

F4 F2 F3 F1

Draw the forces F1 F4 affecting the body using the same color (blue) and the total force with a different color (red dashed line) to the same figure. The title of the figure must contain the magnitude and angle of the total force (cf. example figure below).

Hint: You can use the function line to draw the forces to the coordinate axes (i.e. there is no need to draw the arrowheads, a line is sufficient). For drawing and for computing the total force you need to know the x and y components of each force. In the case of the figure below the x and y components are defined as follows:

cos ( ) = sin ( ) =

x x = F cos ( ) F y y = F sin ( ) F

F x

The angles must be converted to radians before using sin or cos because in Matlab angles are given in radians. However, the angle of the total force must be given finally in degrees.

180 1 rad = .

3

Example figure:

Total force: magnitude 0.99912 N, angle 73.8697 Total force: 0.99912 N, direction: 73.8697

-1

-2

-3 -3

-2

-1

0 x

- (13) Normal DistributionUploaded byASClabISB
- Rmsd and MsdUploaded byJorge Sanchez
- Chapter 04Uploaded byitsmohanecom
- 10_V_Beyond shot retrieval_searching for broadcast news items using language models of conceptsUploaded byleovotinh85
- dc09_west_SAMPLE STATAUploaded byRahat Syful Hoque
- Hwk04 (1).pdfUploaded bySharon Kim
- Some Solved QuestionsUploaded byEdwin Okoampa Boadu
- Statistics ReviewUploaded byLee Kriegelini
- Math SL Revision Sheet 2006Uploaded byAlexas Ngwingyee
- Solutions Chapter03Uploaded byKoko Dandash
- uow060546Uploaded byJoshua Halim
- may_2010Uploaded byFlexx Compton
- 74Uploaded byManikanda Prabhuc
- M1-MiscUploaded byTrungVo369
- TrigonometryUploaded byShang Divina Ebrada
- Comparing Perceptual Noise in Rating ScalesUploaded byJosé Luis Zurita
- Programacion con matlabUploaded byJulian David Barrios Perez
- Math 60 Sample Final ExamUploaded byHannah Patricia Tan
- MidSem 2013S1 SolUploaded byHsingliang Tay
- Transform and Sinusoidal Funct 11Uploaded byDhan C
- Syllabus MATH 30-5 4Q 2016-17Uploaded byEliminated Pro
- Ada 049397Uploaded bySabih Haque
- Lesson 2-07 Properties of Means and Variances.docxUploaded byJamiefel Pungtilan
- 2018 sem 2 math 3 final review 1Uploaded byapi-262277495
- 12080-0130670227_ismSec4.pdfUploaded byAngel Hilasaca
- SAT 2 past paper - Mathematics Level 2 year 2011(1)Uploaded byJinhui Zheng
- Ma 6e Ppt Ch 10 Se NewUploaded byJuliana Anuar
- Tutorial Excel Variance SampleUploaded byMar Cris Velasco
- IntroductionUploaded byKenneth Lance Eustaquio Llanes
- stat-8Uploaded byMiller Yamson

- Immersive Calibration PRO User GuideUploaded byKarthik Reddy
- aac3_2001Uploaded byKarthik Reddy
- Indian Aircraft Rules 1937 Part11Uploaded byvikash_kumar_thakur
- Tps 79301Uploaded byKarthik Reddy
- 2N7002Uploaded byCale McCollough
- Exercises 5Uploaded byKarthik Reddy
- d2o-o10Uploaded byKarthik Reddy
- Auth (1)Uploaded byKarthik Reddy
- IFR Chart SymbolsUploaded byhoushang5
- D2O-O6 (Draft Sept 2011)Uploaded byKarthik Reddy
- ifr_introUploaded byKarthik Reddy
- DGCA CPL ApplicationUploaded byCyril Mathew Roy
- 45483520 Check List COPUploaded byKarthik Reddy
- Exercises 4Uploaded byKarthik Reddy
- Problems 3Uploaded byKarthik Reddy
- Problems 2Uploaded byKarthik Reddy
- Combination of Simple + Tough ProblemsUploaded byKarthik Reddy
- Simple Problems for PracticeUploaded byKarthik Reddy
- Tough ProblemsUploaded byKarthik Reddy
- Raspberry PiUploaded byrob143393
- IntercomUploaded byapi-3750426
- CA28Uploaded byKarthik Reddy
- mini_pmdc_motorsUploaded byKarthik Reddy
- a16weUploaded byKarthik Reddy
- hexcrawler_v3.1Uploaded byKarthik Reddy
- pic-pg2cUploaded byapi-3697567

- 48961941 Flexible Pavement Design IRC37 2001 3Uploaded byChatnoir Noir
- Amplificador de Aislamiento Inductivo Burr-Brown ISO213 BurrUploaded byJoanzarzal
- Response of Outrigger System for High Rise Structure under Wind and Earthquake LoadingsUploaded byVarun KL
- Modified Artificial Bee Colony Algorithm for EdUploaded byIlham Luthfi
- Accpac - Guide - User Manual for OE54.pdfUploaded bycaplusinc
- MT174 Polyphase meterUploaded byYigit Sarıkaya
- Charis' Philosophy of DanceUploaded byCharis Dexter
- Iso Cleanliness CodeUploaded byanuradha
- Web of Science BrochureUploaded byTara Gonzales
- MLAT SamplesUploaded byMansour Wahby
- NITOFLOR TF120 UB.PDFUploaded bytalatzahoor
- Kerite Engineering Catalog.pdfUploaded byTIAGO3045
- LanguageUploaded byGlennmelove
- Cssc3 ManualUploaded byMathew Webster
- USAID Entrepreneurship ToolkitUploaded bynonimugo
- Branding Strategy of IBMUploaded byMobarak Hossen
- EEE 471 Transient Stability.pptUploaded byFrew Frew
- Method Statement for Underground Piping FcUploaded bymister pogi
- 69. Ijasr -Varietal Evaluation of Asiatic Hybrid Lilies Under Open and PolyUploaded byTJPRC Publications
- Dewpoint Calculation Humidity Sensor EUploaded byMason Lee
- Thesis GuidelinesUploaded byZannyRyanQuiroz
- UCSD MAE 8 HW 1Uploaded byJoel Bickel
- 1-s2.0-S0306261918304409-mainUploaded byAndrés Noguera
- Superfix Catalogue 2003Uploaded byDidin Dwi Kristanto
- L3_The Organisational Development PractitionerUploaded byals1508
- Grade4-Olympiad.pdfUploaded byEduGain
- Manual Lenovo A5500Uploaded byamadeo_am
- ALARMAS VISIBLESUploaded byVICKY
- AFEM.Ch20Uploaded byKim Novis
- 06 Learning 4pUploaded byRaedadobeAdobe

## Much more than documents.

Discover everything Scribd has to offer, including books and audiobooks from major publishers.

Cancel anytime.