Attribution Non-Commercial (BY-NC)

18 views

Attribution Non-Commercial (BY-NC)

- MATA33_Final_2011S.pdf
- 4037_y09_sy
- CMSC 405 Homework 4
- IIT JEE(Advanced) Syllabus
- FENET Copenhagen Feb2002 MPA Ellis
- Dpp Maths & Computer-new
- Drawing a Histogram
- Excel
- Robotic Lab 2
- 03 RMS Frequency Planning Method
- Shannon - A Symbolic Analysis of Relay and Switching Circuits
- Tempo Geologico Principais Depositos Minerairis Brasileiros
- ET-302-civil
- Tsnnppt 150201110139 Conversion Gate01.Pptx
- A Symbolic Analysis of Relay and Switching Circuits, Shannon C.E., 1936
- The Mathew Effect
- MATLAB Tutorial
- c++ fem object oriented
- Picturing Distributions With Graphs
- 08 Random Number Generation

You are on page 1of 11

Y = round(X)

Mathematically, the sign of a complex number z 0 is defined as . For real numbers, this reduces to 1 or - 1.

Matlab has a set of dot operators, such as .*, ./, .^. Each of these operators consists of a dot and a normal algebraic operator. They perform element-wise algebraic operations on a matrix. For example, consider the following codes

A = [1 2 3; 3 2 1]; x = [1 2 4]; B = A.^2 y = 1./x

The result is

B = 1 9 y = 1.0000 0.5000 0.2500 4 4 9 1

A sequence of values that appears to be random (i.e. unpredictable) but is actually generated by a deterministic algorithm.

>> rand('seed',0) >> rand(2) ans = 0.2190 0.6789 0.0470 0.6793 >> rand('seed',0) >> rand(2) ans = 0.2190 0.6789 0.0470 0.6793

>> rand('seed',1) >> rand(2) ans = 0.5129 0.3504 0.4605 0.0950 >> rand('seed',1) >> rand(2) ans = 0.5129 0.3504 0.4605 0.0950

randn

Normally distributed pseudorandom numbers

r = randn(n)

returns an n-by-n matrix containing pseudorandom values drawn from the standard normal distribution.

r = randn(m,n)

r = randn(m,n,p,...) r = randn

returns a scalar. returns an array the same size as A. or r = randn(...,'single') returns an array of normal values of

r = randn(size(A))

r = randn(...,'double')

Example 1

Generate values from a normal distribution with mean 1 and standard deviation 2:

r = 1 + 2.*randn(100,1);

Example 2

Generate values from a bivariate normal distribution with specified mean vector and covariance matrix:

mu = [1 2]; Sigma = [1 .5; .5 2]; R = chol(Sigma); z = repmat(mu,100,1) + randn(100,2)*R;

===================================================

L = chol(A,'lower') produces a lower triangular matrix L from the diagonal and lower triangle of

matrix A, satisfying the equation L*L'=A. The chol function assumes that A is (complex Hermitian) symmetric. If it is not, chol uses the (complex conjugate) transpose of the lower triangle as the upper triangle. When A is sparse, this syntax of chol is typically faster. Matrix A must be positive definite. R = chol(A,'upper') is the same as R = chol(A).

abs

Absolute value (magnitude)

hist

Histogram plot

hist(data)

creates a histogram bar plot of data. Elements in data are sorted into 10 equally spaced bins along the x-axis between the minimum and maximum values of data. Bins are displayed as rectangles such that the height of each rectangle indicates the number of elements in the bin. example

The values in data are sorted among 10 equally spaced bins between 0 and 10, the minimum and maximum values.

hist(data,nbins)

example

Specify Number of Bins

Initialize the random-number generator to make the output of randn repeatable. Generate 1,000 normally distributed pseudorandom numbers.

rng(0,'twister') data = randn(1000,1);

figure nbins = 50; hist(data,nbins)

hist(data,xvalues) uses the values in vector xvalues to determine the bin intervals and sorts data into the number of bins determined by length(xvalues). To specify the bin centers, set xvalues equal to a vector of evenly spaced values. The first and last bins extend to cover the minimum and maximum values in data.

example

Specify Bin Intervals

Create a figure divided into three subplots. Plot a histogram of the same data set in all three subplots using different bin intervals for each histogram. First, initialize the random-number generator to make the output of randn repeatable. Generate 1,000 normally distributed pseudorandom numbers.

rng(0,'twister') data = randn(1000,1);

In the upper subplot specify the bin centers using a vector of evenly spaced values that span the values in data.

figure subplot(3,1,1) xvalues1 = -4:4; hist(data,xvalues1)

In the middle subplot specify the bin centers using a vector of evenly spaced values that do not span the values in data. Notice that the first and last bins extend to cover the minimum and maximum values in data.

subplot(3,1,2)

In the lower subplot set the bin intervals using a vector of unevenly spaced values. These unevenly spaced values are not used as the bin centers. MATLAB indicates the specified values by markers along the x-axis.

subplot(3,1,3) xvalues3 = [-4,-2.5,0,0.5,1,3]; hist(data,xvalues3)

hist(axes_handle,___) plots into the axes specified by axes_handle instead of into current axes (gca). The option axes_handle can precede any of the input argument

the

nelements = hist(___)

each bin.

nelements Number of elements in each bin row vector centers Bin centers row vector [nelements,centers] = hist(___) returns an additional row vector, centers, indicating the location of each bin center on the x-axis. To plot the histogram, you can use bar(centers,nelements).

example

Initialize the random-number generator to make the output of randn repeatable. Generate 1,000 normally distributed pseudorandom numbers.

rng(0,'twister') data = randn(1000,1);

Sort data into 10 equally spaced bins. Get the number of elements in each bin and the locations of the bin centers.

[nelements,centers] = hist(data) nelements = 4 27 88 190 270 243 123 38 centers = -2.8915 -2.2105 -1.5294 -0.8484 -0.1673 1.8758 2.5568 3.2379

13

4 0.5137 1.1947

figure bar(centers,nelements)

All the random number functions, rand, randn, randi, and randperm, draw values from a shared random number generator. Every time you start MATLAB, the generator resets itself to the same state. Therefore, a command such as rand(2,2) returns the same result any time you execute it immediately following startup. Also, any script or function that calls the random number functions returns the same result whenever you restart.

If you want to avoid repeating the same random number arrays when MATLAB restarts, then execute the command,

rng('shuffle');

before calling rand, randn, randi, or randperm to ensure that you do not repeat a result from a previous MATLAB session. There also can be situations in which you want to repeat a result that you got at the start of a MATLAB session, but you do not want to restart to do it. You can reset the generator to the startup state at any time in a MATLAB session:

rng('default');

When you execute rng('default'), the ensuing random number commands return results that match the output of a new MATLAB session.

subplot

Description

subplot(m,n,p)

divides the current figure into an m-by-n grid and creates an axes in the grid position specified by p. MATLAB numbers its grids by row, such that the first grid is the first column of the first row, the second grid is the second column of the first row, and so on. example

subplot(m,n,p,'replace') subplot(m,n,p,'align')

deletes any existing axes in grid location p and creates a new axes.

creates a new axes so that the plot boxes are aligned. This is the

subplot('Position',positionVector) creates a new axes at the position specified by positionVector. The positionVector is a four-element vector of the form [left,bottom,width,height], such that the entries are normalized values between 0.0 to

1.0.

If the position vector specifies an axes that overlaps any previous axes, then the new axes replaces the existing ones. example

subplot(___,Name,Value)

specifies properties for the axes using any of the input argument combinations in the previous syntaxes and one or more Name,Value pair arguments.

example

h = subplot(___)

example

subplot(h)

makes the axes with handle h the current axes for subsequent plotting commands.

bar

Bar graph

bar(Y)

example

bar(x,Y)

example

bar(___,width)

sets the relative bar width and controls the separation of bars within a group and can include any of the input arguments in previous syntaxes. example

bar(___,style)

specifies the style of the bars and can include any of the input arguments in previous syntaxes. example

bar(___,bar_color) displays all bars using the color specified by the single-letter of bar_color and can include any of the input arguments in previous syntaxes.

abbreviation

example

bar(___,Name,Value)

sets the property names to the specified values and can include any of the input arguments in previous syntaxes.

- MATA33_Final_2011S.pdfUploaded byexamkiller
- 4037_y09_syUploaded byKhurram Ahmed
- CMSC 405 Homework 4Uploaded byRichard Mcdaniel
- IIT JEE(Advanced) SyllabusUploaded byccinnabar
- FENET Copenhagen Feb2002 MPA EllisUploaded bygodivc
- Dpp Maths & Computer-newUploaded byMuhammad Atif
- Drawing a HistogramUploaded bystraf238
- ExcelUploaded byImran Ahmad
- Robotic Lab 2Uploaded bykienho88
- 03 RMS Frequency Planning MethodUploaded bysohappy2
- Shannon - A Symbolic Analysis of Relay and Switching CircuitsUploaded byAgustín Scaramuzza
- Tempo Geologico Principais Depositos Minerairis BrasileirosUploaded byLuizFischer
- ET-302-civilUploaded bymurugan_collegeman
- Tsnnppt 150201110139 Conversion Gate01.PptxUploaded bymonumunduri
- A Symbolic Analysis of Relay and Switching Circuits, Shannon C.E., 1936Uploaded bytamz_msc
- The Mathew EffectUploaded bygerimox
- MATLAB TutorialUploaded byabbey
- c++ fem object orientedUploaded byTuýp Phờ Nờ
- Picturing Distributions With GraphsUploaded by1ab4c
- 08 Random Number GenerationUploaded byRupa Dn
- How to Make Charts and Tables in ExcelUploaded byLiew Chee Kiong
- HistogramsUploaded bySeana Geddes
- Basic Principles of Plate Theory.pdfUploaded byCarlos Silva Castillo
- computerUploaded byKishan Gupta
- AHPUploaded byankitsurolia
- Presentation Determinants and Matrices.pptUploaded byRodel D Dosano
- Matlab PresentationUploaded byKashan Khan
- Lab_1Uploaded byAfnan Ahmed
- Chapter 1 Sec.4 Math 324Uploaded bydereje
- syllabus_I_DEE_R-13.pdfUploaded bySaiyan Pride

- Maria Petrou, Panagiota Image Processing the Fundamentals 1999Uploaded byChoudhary Hukma
- NOS APPLICATION FORM.5-7.pdfUploaded byChoudhary Hukma
- Ciuonzo SAM 2012-LibreUploaded byChoudhary Hukma
- Optimal Power Allocation for Distributed Detection WSNUploaded byChoudhary Hukma
- Channel Aware Sensor Selection in Distributed DetectionUploaded byChoudhary Hukma
- MATLAB ConceptsjgjhjgugUploaded byChoudhary Hukma
- Nonorthogonal Transmission and Noncoherent Fusion of Censored DecisionsUploaded byChoudhary Hukma
- 3 Optimal Data Fusion in Multiple SensorUploaded byChoudhary Hukma
- BER in 16 QAM MatlabUploaded byChoudhary Hukma
- 2010 Maria Petrou, Costas Petrou(Auth.) Image Processing_ the Fundamentals, Second EditionUploaded byChoudhary Hukma
- Simulation model 16QAM.docxUploaded byChoudhary Hukma
- A1jhkjUploaded byChoudhary Hukma
- Physics 1Uploaded byChoudhary Hukma
- GSM ArchitectureUploaded bypradeep66

- Elint Labz - Magnetic Door Sensor Plug ManualUploaded byKartikey Singh
- Mis TutorialUploaded byNihal Pathan
- Modul Rfm12 Fsk (5)Uploaded byResa Pramudita
- Library study of MUSEUM.pptxUploaded bySHAN ARCHITECTS
- Notice: Analysis of Proposed Consent Order to Aid Public Comment: The TJX Companies, Inc.Uploaded byJustia.com
- Stochastic Processes 2Uploaded bySeham Raheel
- timeline 1315Uploaded byapi-260321046
- JournalNX- Dfa Design SolutionUploaded byJournalNX - a Multidisciplinary Peer Reviewed Journal
- PL SQL ProgramsUploaded bySunil Kumar
- Computer Networks a Top Down Approach by Behrouz ForouzanFirouz MosharrafUploaded byAkhil Bittu23
- Database Research ReportUploaded bysampleassignment.com
- 406RONMFRT0N7269301.pdfUploaded byClaudia Kosztelnik
- BABI ProjectUploaded byShruti Vinyas
- CULAReferenceManual_2.0Uploaded bydawoodk
- Storage PoolsUploaded byMurali Boyapati
- Offline text document authorization on the basis SIFT and SURFUploaded byIJSTE
- Business IntelligenceUploaded bylalitprrasadsingh
- AmazonUploaded byShammi Priyadarshi
- SuperOrca ManualUploaded byarm usa
- barcode-scanner.pdfUploaded byoprs
- 01 ABCS OverviewUploaded byGangadhar Sankabathula
- atandt 5essUploaded bytariqraza
- Linux Hpc Cluster InstallationUploaded byHungleMinh
- WSO2 T24Uploaded byDmitry Kazany
- Template for Gap AnalysisUploaded bySajeel Zaman
- Feynman’s Path Integrals and Bohm’s Particle PathsUploaded bySantiago Poulain
- Automatic OMCH Establishment(SRAN9.0_Draft A).pdfUploaded bySam Ficher
- ATP Criteria July 2017Uploaded bymammutbalaji
- OdeUploaded bySon Herrera
- Clear MindUploaded byShaswat Dubey