Title: MATLAB MATRIX LABORATORY
1????? ???????? ?????? ???? ???"? (2)
????? ??' 4
??? ?''? ?????? ????????
2???? ???? ?????? MATLAB
- ????? ?????? ???? ??
- ???????? ??????? ?? ??????
- ??? ?????? ????? ?????
- ??????? ??????? ??????
- ????????? ??????? ??????? ???? ??????? ?????????
- ??? ?????? ????? - 'PLOTTING TOOL'
- ???? ?- DATA STATISTIC
- ???????
3???? ???? (????)
- ??? MATLAB ?
- MATLAB ???? ????? ????? ????? ????? ???????
- ????? ?????-
Environment - ???? ???????? ??????? -
Mathematical Labrary - ??? ???? -
Matlab Language - ????? ????? ??????? -
Handle Graphics - ????????? ?????????? ????? - Application Program
Interface - MATLAB ?????? ???? ?????? ?????
- ??????? ??????? ???????? ?????????
- ?????? ?????? ??- ???? ??????
- ????? ????????? ???? ????? ??? ?? ???? ??????
4???? ???? (????2)
- ????? ?? ?????? MATLAB
- ???? ?600,000 ??????? ??100 ??????
- ?40,000 ??????? ??????
- ??1,000 ??????? ???? ???????
- MathWorks Co ???? ?????? MATLAB
- http//www.mathworks.com/
- ???????? ???? ????? MATLAB ??????
- http//www.omikron.co.il/
5???????? ???????
- ????? ?????? ??????
- ?????? ???? ???? ???
- ??? ???? ?????? ?????, ????? ?????
????? - ???????.
- ????? ???? ?????? ???? TOOLBOXES ??????? ?????
??? ?? ???????? ???????? ?????? ???????
??????. ???? ????? ??? ??????? ??????
????? ??????? ???? ?????. - ????? ????? 1. ???????????
2. ( Filename.m ) M-FILES - ????????? ( ???? ??? ???? ????? C ? ( C
- ?????? ??????? ?? ????? ???????? ????? ?????
???????? ????? ????? ?? ?? ????? ?????
(?????? ??????? ?? ????? ???????). - MEX-FILES - ????? ???? ????? ????? ??????.
6"????? MATLAB "??? ?????? MATLAB TOOLBOXES
- ????? ?????
- Symbolic Mathematics
- Partial Differential Equations
- Signal Processing
- Image Processing
- Neural networks
- Fuzzy Logic
- Optimization
- SIMULINK (Block Oriented Simulator)
- Data Acquisition
7????? MATLAB
- ????? ???? (R14) 7.0.1 ?PC ???? ??
- DESKTOP
8????? MATLAB(????)
- ???? ?????? MATLAB Command Window
- Desktop -gt Desktop Layout -gt Command Window Only
?????
???? ????
???? ??????
9???? ??????
10???? ?-Editor
- ????? edit ?? File-gt new/open -gt ??_?????? /
??_???????? ????? ?????? ???? Editor/Debugger - ?? ???? ??????.
- ?????? ???? ?? save
11???? ?-Editor (????)
????? ?? ????
???? ????
12???? Workspace
- ????? workspace ?? View-gt Workspace ?? ????
Workspace ?? Desktop - ???????
- gtgt t0pi/42piysin(t)
- ???? Workspace ????
?? ?????
???? ???? ?????? ????
???? ????? ????? ?????? ?? ?????
13??????? ?????????
- ???? ????????? ???????? ??????? ????????
- /????? ?????
?????? ?? ????????? ??????? ???????? - sin,cos,tan,cot,log
- ???.
- ???? ????? ????? ????? ?? ??????????????
pi - ?????? ????????? I
?????? ???????? ????? ?????????? ??? e
- (??? ?? ???? ????, ?????? (
log10(x )
14????? ?????? ???? ??????? ?????????
- / (SLASH) ??? ???? ?????? ????????
- \ (BACK SLASH ) ???????? ???? ?? ????
???????????. - ?????? ans ??? ?????? ??????? ??????
?????? ?????, ??? ?? ????? ????? ??????
??. - ???? ????? ???? ?????? ????? ?????
?????? ???????. (???? ????? ???? ) - ?(up arrow) ???? ?????? ???????
15??????? ???????? ?????????
- indicates comments -- Matlab works in
radians (sin(23.5))2 without
results are displaying immediately ans
0.9962 (sin(23.5))2 with
results are not displaying
16????? ????? - Demos
- Help -gt Demos-gt MATLAB -gt DESKTOP TOOLS -gt Run
This Demo
17????????? ??????? ??????? ???? ??????? ?????????
- y random('name',A1,A2,A3,,m,n)
- Where
- name is
- 'beta' 'bino' 'chi2' or 'Chisquare'exp' or
'Exponential'ev' or 'Extreme Value 'f'
'gam' or 'Gamma 'gev' or 'Generalized Extreme
Value 'gp' or 'Generalized Pareto 'geo' or
'Geometric 'hyge' or 'Hypergeometric 'logn'
or 'Lognormal 'nbin' or 'Negative Binomial
'ncf' or 'Noncentral F - 'nct' or 'Noncentral T 'ncx2' or
'Noncentral Chi-square 'norm' or 'Normal
'poiss' or 'Poisson 'rayl' or 'Rayleigh 't'
'unif' or 'Uniform 'unid' or 'Discrete
Uniform 'wbl' or 'Weibull - A1,A2,A3, - distribution parameters
- m,n - matrix sizes
- gtgtrn random('Normal',0,1,2,4)
- rn
- 1.1650 0.0751 -0.6965 0.0591
- 0.6268 0.3516 1.6961 1.7971
18??? ?????? ????? 'PLOTTING TOOL'
- gtgtdata1rand(1,15),data2randn(1,100)
- gtgtplottools
1.Click for plot 1
2.Click for subplot
????? ????? ???? ????? ????
19??? ?????? ????? 'PLOTTING TOOL' (????)
4.Window getting with click on MORE
3.Right click on data1 and choice of HIST(x)
20??? ?????? ????? 'PLOTTING TOOL' (????2)
??? ????? ?????? ??? PLOTTOOLS OFF ?-
21??? ?????? ????? 'PLOTTING TOOL' (????2)
1. ??? ????? ?????? ??? ????? ?? - PLOTTOOLS
OFF 2. ????? ?- random ???? ?????????? ????
????? lognormal, exponential, weibull , ?-gamma
22??????? ?? ????? ??????
?????? ????????? ???"? ??? 1900 ???? 1990 t
1900101990 p 75.995 91.972 105.711
123.203 131.669 ... 150.697 179.323 203.212
226.505 249.633 p2000spline(t,p,2000),plot(t,
p,d,t, p2000) p2000 270.6060 ?????? ????
(?????) 2000 281.4219 p_tru
281.4219errror(p_tru-p2000)/p_tru100 errror
3.8433 errror_roun(roundn(p_tru,0)-roundn(p
2000,0)/roundn(p_tru,0)100 rounded
error errror_roun 3.5587
23????? ???? ??????? ????? fprintf
- ????? ?? ?????? ??? ???? ?????? ???
- fprintf(Text 5.2f Additional text \n,
variable name) - - sign the spot where the number is inserted
- 5.2f - field width and precision
- f - fixed point notation (for example -7.09)
- \n - new line
- ??????
- gtgttptp from previous slide
- gtgtfprintf('Year 5.0f People 5.4f millions
\n,tp) - Year 1900 People 75.9950 millions
- Year 1910 People 91.9720 millions
- Year 1920 People 105.7110 millions
- Year 1930 People 123.2030 millions
- Year 1940 People 131.6690 millions
- Year 1950 People 150.6970 millions
- Year 1960 People 179.3230 millions
- Year 1970 People 203.2120 millions
- Year 1980 People 226.5050 millions
- Year 1990 People 249.6330 millions
24????? ?????? ?????? ?????? ???
- ????? ???? ???????
- help command ???? ?????? ?? ??????? ???? ??
????? ?????? ?? ?? ????? ??
??????? - lookfor key word or command or function
????? ???? Pointer ????????? ??????? ??
???? ??????????? - gtgt lookfor hexadecimal
- DEC2HEX Convert decimal integer to hexadecimal
string. - HEX2DEC Convert hexadecimal string to decimal
integer. - HEX2NUM Convert IEEE hexadecimal to double
precision number. - HEX2NUM Hexadecimal string to number.
- NUM2HEX Number to hexadecimal string.
- HEX2BIN Convert hexadecimal strings to binary
strings.
25????? HELPDESK
- helpdesk for receiving Help Desk Window
- Help from Desktop Help - for ML 7
26?????? ??? (????)
- ????? ???? ??????? ??????? ????? ???? ??????
?????? - ????? who - a8 b9
- c1i
- dabc
- e1 2 3 4 5 6 7
- who
- Your variables are
- a b c d e
27????? INPUT
- variable input(string')
- gtgt ainput('enter a ')
- enter a 2
- a
- 2
- gtgtainput('enter a\n) \n - skip to the next
line - enter a
- 2
- a
- ltlt ainput('enter a ','s') \s string
variable - enter a gady
- a
- gady
28????? ?????? ??????
- 1. kovets save
- ?????? ?? ??????? ??????? ??????
?????. - a8
- b1i
- c3
- save kovets
- 2. save kovets variable1 variable2
- ?????? ??? ???????? ?????
- a9
- b3
- save zz a
29????? ?????? ??????
- ????? ?????? ???? ?????? ??????
- ????? ??????? ?????? ??? help save
- ?????? ????? ??? ?? ???????, ????? ???? ???
zz.mat ??? ??? kovets.mat ?????? ??? 1 (??? ????) - ?? ????? ?? ????? ?????? ASCII
- SAVE fname X Y Z -ASCII???? ???? ????? ??? ????
????? (EXT), ????? zz
30????? ?????? ??????
- ????? clear ????? ???? ?? ?? ??????? ??????
??????. - ????? clear variable_names ????? ??????
??????? ???? - clear a b
- whos
- Name Size Bytes Class
- c 1x1 16 double array
(complex) - d 1x1 16 double array
(complex) - e 1x7 56 double array
- Grand total is 9 elements using 88 bytes clear
- whos for showing of clear effect
-
31???? DATA STATISTIC
- Plot your data. For example, use these commands
to plot the historical population data from the
United States. - gtgt load census
- gtgt plot(cdate,pop,'')
- In the figure window, select Tools gt Data
Statistics
32???? ??????? ????????? - DATA STATISTIC(????)
- In the Data Statistics dialog, select the check
box for each statistic you want to display on the
plot. For example, to plot the mean of the
population (Y-data), select the check box for the
Y mean. The plot legend is updated to include
each statistic measure you display on the plot.
For example, y mean.
33???? ??????? ????????? (????2)
- Saving Statistics to the MATLAB Workspace
- To save the statistics generated by the Data
Statistics tool to the MATLAB workspace, follow
this procedure. - Click the Save to Workspace button. In the Save
Statistics to Workspace dialog, specify the sets
of statistics you want to save (X-data and
Y-data). Enter the corresponding variable names.
34???? ??????? ????????? (???? 3 )
- The Data Statistics tool saves each set of
statistics to a structure. - For example, when you select to save the X-data
statistics for the census data in the variable
census_dates, the resulting structure looks like
this - gtgtcensus_dates
- min 1790
- max 1990
- mean 1890
- median 1890
- std 62.0484
- range 200
35???????
- ???? ????? ?????? ????? ??????? ???? s ????? ???
1 ?-10. ????? ?- SLIDER - ???? ????????? ???? ?????? ??????? ????? ????????
rnorm ???? ???? ?????? ????? ??? 10 ?-1000. ?????
? SLIDER. - 3. ???? ?? ??????? ??????? ???????? (????? 2)
????? ?-pdf ?? ????? ???????.
36??????? (????2)
-
- 4. The distance d from point (x0,y0) to a line
AxByC0 is given by - Determine d when x02,y0-3, A3, B5, C-6. Plot
3D graph of d as function of x0 and y0 - (Use symbolic toolbox command for substitute and
plotting). - 5. Evaluate
- when a15.62, b-7.08, c62.5, d0.5(ab-c). Use
fprintf for printing result and inputted variables