What are MATLAB script files

preview_player
Показать описание
We build our first MATLAB script file to solve quadratic equations:

00:00 -Introduction
00:11 -Case study problem statement: solve a quadratic equation
01:27 -Best practice: Spend time understanding the problem before coding
01:54 -Understanding quadratic equations: what we know
02:38 -Identify values for quadratic coefficients a, b, and c
03:07 -Four methods to solve quadratic equations
03:20 -More information about the AC Method (link)
03:39 -More information about graphical technique (link)
03:44 -Use quadratic formula to solve our quadratic equation in MATLAB
03:59 -State the quadratic formula
05:10 -Review materials for quadratic equations (links)
05:33 -In general, studying the problem takes a lot of time
06:27 -Draft a solution to quadratic equation in Command Window
06:48 -Declare coefficient variables: a, b, and c
07:00 -Declare solution variable x1
07:42 -Re-use code to declare solution variable x2
08:17 -Verify that our calculated solution actually solves the problem
09:32 -The Command Window's power: Interactive terminal programming
10:46 -The weaknesses of the command window format
10:59 -Example: Using Command Window is a headache
12:36 -Correcting errors in Command Window is frustrating
13:05 -Command Window is not designed for large projects
13:18 -MATLAB Script files are more efficient for organizing large projects
13:25 -Create a new script file using “New Script” button in Toolstrip
13:35 -The Editor browser to write Script, Function, and Class files
13:51 -Three new Toolstrip tabs in Editor window: Editor, Publish, View
14:27 -Copy and paste previous Command Window code into the Editor
14:39 -Save changes often: use ‘*’ next to script name as a reference
15:17 -Use the ‘Save’ button
15:50 -Start files with capital letter (don't confuse with built-in files)
16:11 -Locate your script file on your computer in the Editor Window
16:34 -MATLAB’s .m file type
16:45 -Save your work frequently to avoid losing code
17:07 -Run your script file by pushing a single button
17:31 -Push ‘Change Folder’: switch the Current Folder and run your script
18:56 -What happens when you ‘Run’ your script file
19:21 -Programming in Command Window versus Script files
19:42 -Syntax highlighting of equals sign to remind you to use semicolon
20:14 -Suppress all output for script file
20:30 -Run script file using Command Window to solve quadratic equation
22:53 -Calculate solutions to any quadratic equation using this script
23:44 -Workspace variables are ordered alphabetically
24:01 -Use line numbers in Editor window to refer to specific lines of code
24:29 -Undock the Editor window
24:47 -This is poorly written code
25:11 -Analogy comparing the Command Window versus Script files
26:37 -Community challenge: Your own analogy for Command Window versus Script files
Рекомендации по теме
Комментарии
Автор

21:38
I have a question about that part.
Line 6 and 7 have different codes, but why do we have only one 'ans' in the workspace?
Even though we haven't assigned line 6 and 7 into particular variables, they are different.
So, I expected that the workspace will have two 'ans' like ans1= 0 and ans2 = 0.
Is this because line 6 and 7 have the same output when they are executed?

xoheey
Автор

For me command window looks like the terminal on mac and script looks like a main.cpp file that we compile and run.

amidnajmi
Автор

One question though. This may be a little too early to ask but how do we declare variables in matlab? I am kind of used to the c++ and java syntax where we specify the type of the variable and allocate memory to it.

amidnajmi
join shbcf.ru