Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize Program Design with matlab

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces how matlab program design, has a certain reference value, interested friends can refer to, I hope you read this article after a great harvest, the following let Xiaobian with you to understand.

MATLAB programming

Basic requirements:

(1)Learn Matlab M file preparation methods, including command files and function files. Understand debugging commands and debugging methods of M pieces;(2) Master Matlab program structure (sequence structure, loop structure and branch structure) and flow control statements skillfully. OutlineM-file; Input and output of data; Programming; Function files; Global and local variables

1.M file

MATLAB language program, called M file. M files have two types: command files and function files. Command file: No input parameters and no output parameters returned. Function file: can input parameters, can also return output parameters.

Input function: used to input a parameter to the computer. Call format: A=input(prompt information, option); Note: 's' option allows the user to enter a string. For example, if you want to enter a person's name, you can use the command

xm=input('What''s your name:','s')

pause function: suspends execution of the program. Call format: pause(seconds of delay) Note: If you omit the delay time and use pause directly, the program will pause until the user presses any key and the program continues to execute.

Disp function: command window output function. Call format: disp(output item) Note: Output item is string or matrix. for example

A='Hello,MATLAB';disp(A)

Output: Hello,MATLAB

2. programming

- For statement:

Format:

for loop variable = expression 1: expression 2: expression 3 loop body statement end

Note: The value of Expression 1 is the initial value of the loop variable, the value of Expression 2 is the step size, and the value of Expression 3 is the final value of the loop variable. Expression 2 can be omitted when the step size is 1

while statement

Format:

while (conditional) loop body statement end

According to the expression for y in Example 3.6, find: (1)y

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report