1. Trang chủ
  2. » Cao đẳng - Đại học

Matlab training course_ basic

61 30 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Nội dung

Examples and excises codes are free for education goals, contact me via facebook: roland.nam.5 MATLAB FUNDAMENTALS AND PROGRAMMING TECHNIQUES (BASIC) Claire Chuang support@terasoft.com.tw Course Outline ⚫ Working with the MATLAB User Interface ⚫ Variables and Commands ⚫ Analysis and Visualization with Vectors and Matrices ⚫ Automating Commands with Scripts ⚫ Appendix: Data Types How to Use This Manual ⚫ Code font is used for code, function names and URLs It also occurs on the slides in one of the lower corners as reference to relevant files or commands for the example >> command_line_code >>[a,b,c] = command_in_file(d,f); ⚫ At times, code may run off the line The line continuation character (…) is used to show this These are valid MATLAB statements if typed as shown, including carriage returns >> [CFlowAmounts, CFlowDates, TFactors] = cfamounts(couponRate, settle, maturity); ⚫ Menu items, options and key names are highlighted in bold in the notes sections Use Ctrl+C to break out of execution Click on File, Set Path to open the Path Browser >> try this at the prompt Course Outline ➢ Working with the MATLAB User Interface ⚫ Variables and Commands ⚫ Analysis and Visualization with Vectors and Matrices ⚫ Automating Commands with Scripts ⚫ Appendix: Data Types The MATLAB® Desktop Current folder Command Window Commands entered & results returned Current Folder Files in the current folder Workspace Variables(data) in memory Customizing the Desktop Window actions Window actions Resize & reposition Variables in the Base Workspace 19 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 NaN 1.96 1.89 1.73 1.84 1.95 2.12 2.05 1.63 1.72 1.94 1.71 1.76 2.19 2.72 3.23 3.54 3.85 4.45 1.87 1.92 1.73 1.57 1.45 1.53 1.61 1.62 1.38 1.52 1.86 1.72 1.69 1.99 2.37 2.89 3.26 3.59 4.08 3.63 3.45 3.56 3.41 3.59 4.26 4.41 3.87 3.85 3.8 3.51 3.62 4.35 4.99 5.46 5.88 6.6 7.51 2.65 2.9 3.27 3.07 3.52 3.96 3.94 3.53 3.34 3.42 3.45 3.4 3.67 4.59 5.24 5.66 6.03 6.88 7.75 4.59 4.5 4.53 3.68 3.7 4.39 4.07 3.84 3.87 3.77 3.57 3.74 4.53 5.29 5.74 6.1 6.73 7.63 11 3.16 3.46 3.58 4.16 4.36 4.43 3.64 3.26 2.82 3.27 3.65 3.27 3.15 3.47 3.93 4.28 4.47 4.49 5.74 1.3 1.5 1.56 1.48 1.11 1.25 1.47 1.49 1.79 2.01 2.2 2.24 2.04 2.03 2.22 2.31 2.4 2.45 2.05 2.49 2.65 2.88 2.87 2.94 3.18 3.34 3.04 3.8 4.18 3.76 3.84 4.11 4.51 5.28 5.92 6.21 5.83 2.82 3.01 3.06 2.84 2.99 3.21 3.34 3.83 4.06 4.29 4.58 4.13 4.16 4.7 5.56 5.97 6.36 7.13 7.42 1.16 1.14 1.13 1.11 1.11 1.15 1.23 1.23 1.06 1.17 1.51 1.46 1.36 1.59 1.88 2.3 2.59 2.8 3.27 numeric data → “double precision” The Variable Editor Navigating the Help Browser Help and Documentation search browse Q&A Thank you very much Have a good time Course Outline ⚫ Working with the MATLAB User Interface ⚫ Variables and Commands ⚫ Analysis and Visualization with Vectors and Matrices ⚫ Automating Commands with Scripts ➢ Appendix: Data Types MATLAB® Data Types Creating Vectors and Matrices Manual entry Creation functions [] 19 13 11 17 3.1 4.2 9.0 8 Arbitrary data 10 12 14 16 1 1 1 1 0 0 1.0 1.2 1.4 1.6 1.8 2.0 Pattern of values Entering Vectors Manually >> x = [19 13 11 17 3] >> x = [19;13;7;11;2;17;5;3] Creating Vectors of Equally Spaced Values >> x = linspace(a,b,n); n points x a b dx >> x = a:dx:b; Creating Matrices >> A = [1,2,3; 4,5,6; 7,8,9]; or >> A = [1 3; 6; 9]; or >> A = [1 9] data entry mode Creating Matrices n m >> A = fun(m,n); compan eye gallery hadamard hankel hilb invhilb magic ones pascal rand randi randn rosser toeplitz vander wilkinson zeros Using Built-In Functions and Constants Constant >> x = sqrt(pi); Function Input Output function_name( ); Indexing into Vectors Indexing into Matrices - Linear Indexing >> A = magic(5) A = 17 24 11 23 12 13 13 10 12 14 19 11 10 18 15 25 Indices Data 17 14 18 20 19 21 20 16 21 15 22 16 23 22 24 25 end Indexing into Matrices - Row, Column Indexing >> gpdata(1,2) >> gpdata(3,6) >> gpdata(end,2) >> gpdata(2,end) >> gpdata(end,end) Indexing into Matrices - Multiple Row, Column Indices >> Year = gpdata(:,1) >> gpdata([3,4],6:9) >> gp08 = gpdata(end,2:end) Exercise ◆ A = magic(5) ◆ a=A(?) ◆ b=A(?) ◆ c=A(?) back a A= c b 17 24 15 23 14 16 13 20 22 10 12 19 21 11 18 25 Creating Characters and Text >> y = x >> y = 'x' variable called x character “x” back ... Working with the MATLAB User Interface ⚫ Variables and Commands ⚫ Analysis and Visualization with Vectors and Matrices ⚫ Automating Commands with Scripts ⚫ Appendix: Data Types The MATLAB? ? Desktop... does MATLAB display a listing of the variables currently in memory and their associated attributes? A Command Window B Workspace browser C Current Directory browser D Command History T/F: The MATLAB. .. The MATLAB desktop is customizable The default MATLAB variable type for numeric data is: A Single B Double C Cell Course Outline ⚫ Working with the MATLAB User Interface ➢ Variables and Commands

Ngày đăng: 23/09/2020, 16:23

TỪ KHÓA LIÊN QUAN

w