Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Automating Graph Creation | Visualizations
Matlab From Beginner to Professional
course content

Contenido del Curso

Matlab From Beginner to Professional

Matlab From Beginner to Professional

1. Basic Syntax And Coding With A Text Editor
2. Coding Foundations
3. Learning Through Applications
4. Visualizations
5. Recursion + Matrix Multiplication

bookAutomating Graph Creation

Learn how to automate graph production by writing programs to produce graphs for you! You'll also learn how to have your program save the graph as an image file to a specific location on your computer. Programming graphs can save you enormous amounts of time and make all your images uniform and professional.

Alternative Ways To Get Code


As of version 2024b, Matlab is currently transitioning its figure editing interface.

Function Version

With a figure open, click on File then Generate Code

Code Version

Right click on a figure, then select Show Code

Task

Write a graphing program that creates the graph you chose for your chapter 1 task and saves an image of it to a location on your computer.

  • Create the graph manually;
  • Export the code (function and code versions);
  • Optimize the code into a single, optimized program.

At the end, you should be able to input different variables into your function and have it output the same graph for each by running your program.

  • The order of commands is important (as with all our programming);
  • Use the linter, and Matlab’s feedback when you run the program, to intuit the cause of errors;
  • You can always keep both original versions (function and code) in your final version for redundancy to ensure that everything works (although the function can only be defined once). The reason we boil it down is so that everything can be modified in the code at a later date, if we so choose. If there are redundancies, this will make modifications less clear, and likely necessary in two places (each of the original versions);
  • If you renamed variables, make sure they’re renamed everywhere they occur;
  • If all else fails, try first reproducing the example in the video to get a better feel for how it goes.

¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Sección 4. Capítulo 2
We're sorry to hear that something went wrong. What happened?
some-alt