Prerequisite: Introduction to MATLAB
MATLAB is a powerful programming language, that can be used to draw various plots used in machine learning, deep learning, computer vision, and big data programming. Let us start with coding for plots in MATLAB.
Example 1: Let us first understand the simple plot :
% angle from 0 to 2pi theta = 0 : 0.01 : 2 * pi; % sin function works on an array f = sin(theta); % 2D plot plot(theta, f, 'b' )
% label for X-axis xlabel( '\theta' );
% label for Y-axis ylabel( 'sin(\theta)' );
title( 'Plot of Sine function' )
|
Output :
% angle from 0 to 2pi theta = 0:0.01:2*pi; % sin function works on an array f = sin(theta); % 3D plot t = 0 : pi / 50 : 10 * pi; % open a new figure figure % 3D plot (helix) plot3(sin(t), cos(t), t); |
Output :
% angle from 0 to 2pi theta = 0 : 0.01 : 2 * pi; % sin function works on an array f = sin(theta); t = 0 : pi / 50 : 10 * pi; % open a new figure figure % Riemann surfaces figure cplxroot(5) % plots the Riemann Surface for w = z ^ (1 / 5)
|
Output :