Programming

Matlab / Simulink / Stateflow


Matlab / Simulink / Stateflow is a popular calculation and simulation environment for scientists and engineers. You can program in text mode (Matlab) or in a visual icon based environment (Simulink or Stateflow). The text programming is its own language, but it is as easy to learn as other text based languages. The visual based environment looks a lot like computer desktops with icons. The big difference is that the icons can do mathematical operations. You can drag and drop icons and connect the icons. Following the arrows from beginning to end is just like reading a text based language from top to bottom.

Download software: http://www.mathworks.com/academia/student_version/

Cost: Student versions are less than $100

Instructions to setup software: Follow instructions to download and install

Hardware requirements: PC, Mac

Operating systems supported: Win, Mac

Difficulty level: 4 out of 5


TRY IT!

1. Be sure to perform these steps on a computer with Matlab properly installed.

2. Create a folder on your hard drive -– call it “MatlabDemo”. No spaces.

3. After launching Matlab, be sure that the browser at the top of the window has the same path as the folder location you created above.

4. Download one of the following files into folder you created above. Unzip the file.

5. With Matlab installed on the computer, you can launch it with any of the programs that end in *.m or *.mdl.

6. If you right click on any of the files from the browser and open with wordpad or any similar program, you will see the source code used by Matlab to create the images (mdl files) or run the script (m files).


ABOUT THE PROGRAM — A VISUAL WALK THROUGH

1. Open the file “MATLABsimulinkSTATEFLOWstudent C.Hideg 15jun2013.pptx” for instructions on how to run the different programs. The code operates with any Matlab installation including the student version.

2. Open the file “MATLABsimulinkSTATEFLOW C.Hideg 02may2013.pptx” for instructions on how to run the different programs. The code operates with some nice graphics and the Matlab installation must include the “Dials and Gauges” toolbox.

3. The file “TemperatureSampleCode.m” is a script file that operates in the command window of Matlab. You can either type TemperatureSampleCode after the “>>” prompt or double click on the name in the file window and hit the run button at the top of the new program window. Matlab is case sensitive, so be sure of what you type.

4. A picture is worth a thousand words in this programming language. When double clicking on the “TempConvert_Student.mdl” or “TempConvert2_Student.mdl” more windows appear. The program is laid out in icons similar to many operating systems you will find on PCs, netbooks, etc.


LEARN MORE

http://www.mathworks.com/academia/ — the location to download a student version of Matlab. It is also a source of examples and tutorials.

http://www.mathworks.com/academia/student_version/ — selecting the Student Version field yields this page with many more resources for an introduction into a professional engineering environment.

Write a comment about “Matlab / Simulink / Stateflow”

Nickname:

Type your comment:

  • 1. Safety. Do the following:
      a. Show your counselor your current, up-to-date Cyber Chip.
      b. Discuss first aid and prevention for the types of injuries or illnesses that could occur during programming activities, including repetitive stress injuries and eyestrain.

    2. History. Do the following:
      a. Give a brief history of programming, including at least three milestones related to the advancement or development of programming.
      b. Describe the evolution of programming methods and how they have improved over time.

    3. General knowledge. Do the following:
      a. Create a list of 10 popular programming languages in use today and describe which industry or industries they are primarily used in and why.
      b. Describe three different programmed devices you rely on every day.

    4. Intellectual property. Do the following:
      a. Explain how software patents and copyrights protect a programmer.
      b. Describe the difference between licensing and owning software.
      c. Describe the differences between freeware, open source, and commercial software, and why it is important to respect the terms of use of each.

    5. Projects. Do the following:
      a. With your counselor’s approval, choose a sample program. Then, as a minimum, modify the code or add a function or subprogram to it. Debug and demonstrate the modified program to your counselor.
      b. With your counselor’s approval, choose a second programming language and development environment, different from those used for requirement 5a and in a different industry from 5a. Then write, debug, and demonstrate a functioning program to your counselor, using that language and environment.
      c. With your counselor’s approval, choose a third programming language and development environment, different from those used for requirements 5a and 5b and in a different industry from 5a or 5b. Then write, debug, and demonstrate a functioning program to your counselor, using that language and environment.
      d. Explain how the programs you wrote for requirements 5a, 5b, and 5c process inputs, how they make decisions based on those inputs, and how they provide outputs based on the decision making.

    6. Careers. Find out about three career opportunities in programming. Pick one and find out the education, training, and experience required. Discuss this with your counselor and explain why this career might be of interest to you.

  • Earning the Cyber Chip can help you learn how to stay safe while you are online and using social networks or the latest electronic gadgets.

    Topics include cell phone use, texting, blogging, gaming, cyberbullying, and identity theft. Find out more about the Cyber Chip at www.scouting.org/cyberchip.