tailieunhanh - Lecture note Data visualization - Chapter 26

This chapter presents the following content: Basic definitions, example of a database, typical DBMS functionality, main characteristics of the database approach, database users, workers behind the scene, . | Lecture note Data visualization - Chapter 26 Lecture 26 Recap Saving Plots Summary of Chapter 5 Introduction of Chapter 6 Function M files User defined functions are stored as M files and can be accessed by MATLAB if they are in the current folder or on MATLAB s search path Syntax of Function M file Both built in MATLAB functions and user defined MATLAB functions have the same structure Each consists of a name user provided input and calculated output. For example the function cos x is named cos takes the user input inside the parentheses in this case x calculates a result Continued . User defined functions are created in M fi les. Each must start with a function definition line that contains The word function A variable that defines the function output A function name A variable used for the input argument For example function output my_function x is the first line of the user defined function called my_function Continued . Here s an example of a very simple MATLAB function that calculates the value of a particular polynomial function output poly x This function calculates the value of a third order polynomial output 3 x. 3 5 x. 2 2 x 1 The function name is poly the input argument is x and the output variable is named output Before this function can be used it must be saved into the current folder Continued . Once the M file has been saved the function is available for use from the command window from a script M fi le or from another function You cannot execute a function M file directly from the M file itself. This makes sense since the input parameters have not been defined until you call the function from the command window or a script M file Consider the poly function just created. If in the command window we type poly 4 then MATLAB responds with ans 265 Comments As with any computer program code should be commented liberally so that it is easy to follow However in a MATLAB function the comments on the line immediately following the very first line serve a .

crossorigin="anonymous">
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.