liminfo

MATLAB Reference

Free reference guide: MATLAB Reference

39 results

About MATLAB Reference

This MATLAB Reference is a searchable cheat sheet covering MATLAB programming and engineering computation, organized into eight categories: Basics, Matrices, Plots, Functions, File I/O, Control Flow, Simulink, and Toolboxes. Each entry includes the command syntax, a description, and practical code examples.

The reference covers fundamental MATLAB operations including variable assignment, disp/fprintf output, if/elseif/else conditionals, for and while loops, function definitions, matrix creation (zeros, ones, eye, linspace), element access with indexing, matrix vs. element-wise operations (A*B vs. A.*B), inverse, determinant, eigenvalues, and size/length queries.

Advanced topics include 2D/3D plotting (plot, subplot, bar, histogram, surf, scatter), anonymous functions with @ notation, nargin/nargout, varargin/varargout, file operations (fopen/fclose/fscanf, csvread/csvwrite, load/save, readtable/writetable), Simulink model programming (add_block, add_line, set_param, sim), and toolbox functions for Statistics, Signal Processing, Image Processing, Optimization, Neural Networks, and Control Systems.

Key Features

  • Complete MATLAB reference with 46+ entries organized into 8 categories
  • Matrix operations: creation (zeros, ones, eye), indexing, multiplication vs. element-wise, inv, det, eig
  • Plotting: plot, subplot, bar, histogram, surf, scatter with labels and formatting options
  • Functions: definitions, anonymous functions (@), nargin/nargout, varargin/varargout
  • File I/O: fopen/fclose, csvread/csvwrite, load/save MAT files, readtable/writetable
  • Control flow: switch/case, try/catch, break/continue/return, and assert
  • Simulink: model creation, add_block/add_line, set_param/get_param, simulation execution
  • Toolboxes: Statistics, Signal Processing, Image Processing, Optimization, Neural Network, Control System

Frequently Asked Questions

What MATLAB topics does this cheat sheet cover?

It covers eight categories: Basics (variables, output, conditionals, loops, functions), Matrices (creation, indexing, multiplication, inv, det, eig, size, linspace), Plots (plot, subplot, bar, histogram, surf, scatter), Functions (anonymous, feval, nargin, varargin), File I/O (fopen, csvread, load/save, readtable), Control Flow (switch, try/catch, break, assert), Simulink (model management, block programming, simulation), and Toolboxes (Statistics, Signal Processing, Image Processing, Optimization, Neural Network, Control System).

What is the difference between A*B and A.*B in MATLAB?

A*B performs standard matrix multiplication following linear algebra rules (inner dimensions must match). A.*B performs element-wise multiplication where corresponding elements are multiplied individually (matrices must be the same size). Similarly, A.^2 squares each element rather than computing A*A as a matrix product.

How do I create and manipulate matrices in MATLAB?

Create matrices with brackets: A = [1 2; 3 4]. Use zeros(m,n), ones(m,n), eye(n) for special matrices. Access elements with A(i,j), entire rows with A(i,:), columns with A(:,j). Use inv(A) for inverse, det(A) for determinant, [V,D] = eig(A) for eigenvalues, and linspace(a,b,n) for evenly spaced vectors.

How do I create plots in MATLAB?

Use plot(x,y) for 2D line graphs with title(), xlabel(), ylabel() for labels. subplot(m,n,p) arranges multiple plots. bar() and histogram() create bar charts and histograms. surf(X,Y,Z) renders 3D surfaces (use meshgrid to generate X,Y grids). scatter(x,y) creates scatter plots.

What are anonymous functions in MATLAB?

Anonymous functions use the @ syntax for inline function definitions: f = @(x) x.^2 + 2*x + 1. Call with f(3). They capture workspace variables at creation time. Use feval(@funcname, args) to call functions via handles. nargin/nargout check argument counts, and varargin/varargout handle variable arguments.

How does Simulink integration work in MATLAB?

Open models with open_system(), run simulations with sim() or simout = sim(mdl, "StopTime", "10"). Programmatically add blocks with add_block() and connections with add_line(). Configure parameters with set_param()/get_param(). Access output data from simout.yout.

What MATLAB toolboxes are covered in this reference?

Six toolboxes: Statistics (mean, std, ttest), Signal Processing (fft, butter, filter), Image Processing (imread, rgb2gray, edge detection), Optimization (fminunc), Neural Network (feedforwardnet, train), and Control System (tf, step, bode, rlocus). Each includes practical function calls and usage patterns.

Is this MATLAB reference free?

Yes, completely free with no usage limits and no account required. All content loads in your browser with instant search and category filtering. Works on desktop, tablet, and mobile with dark mode support.