In this lab, we will learn to write MATLAB script files and MATLAB func- tions. 1. Please study the following sections o

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

In this lab, we will learn to write MATLAB script files and MATLAB func- tions. 1. Please study the following sections o

Post by answerhappygod »

In This Lab We Will Learn To Write Matlab Script Files And Matlab Func Tions 1 Please Study The Following Sections O 1
In This Lab We Will Learn To Write Matlab Script Files And Matlab Func Tions 1 Please Study The Following Sections O 1 (56.28 KiB) Viewed 43 times
In this lab, we will learn to write MATLAB script files and MATLAB func- tions. 1. Please study the following sections of the MATLAB tutorial: (a) "Scripting Files: http://www.isr.umd.edu/ austin/ence202.d/matlab.html#sec8 (b) "Functions and Function Files:" http://www.isr.umd.edu/'austin/ence202. ... .html#sec9 There is no need to print the tutorial. The most effective way to read it is to start MATLAB and Netscape and then type in the examples in MATLAB as you read the tutorial in Netscape. If something in the tutorial is confusing, type it into MATLAB to see exactly what it does. 2. Script Files: (a) Using the text editor of your choice, create a file named example1.m. This will be a MATLAB script file. A script file is very simple it contains ordinary MATLAB commands that you will (later) ex- ecute in MATLAB. The script file you create should contain the following MATLAB commands: x = -5:0.01:5 y = exp(-abs(x)) *cos (2pi-z); plot(x,y); xlabel('time'); ylabel('amplitude'); title('f(x)=exp(-1x1) cos(2*pix)); It is very important that the filename you created end in "m" and that you use a text editor. If you are unsure what a text editor is, use Notepad on the PC's or pico or emacs or vi on Unix machines. They are easy to learn and will produce text files that MATLAB can read. On the PC's, save the file to g:\lexample1.m. On the UNIX machines, save it to example1... (b) Start MATLAB. At the MATLAB prompt, type in the name of the file you created above, except for the ".." part: (PC's only) >> example1 >> cd 8
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply