Main

Plotting with MATLAB

Effective plots are important to synthesize the information into relevant and persuasive information. The following tutorial details some of the common data plotting functions within MATLAB.

Tutorial MATLAB Source Code

 clear all; close all; clc
 x = linspace(0,6);
 y = sin(x);
 z = cos(x);
 h = figure(1);
 plot(x,y,'r--')
 hold on
 plot(x,z,'b.-','LineWidth',3)
 xlabel('x')
 ylabel('values')
 legend('y','z')
 xlim([0 3]);
 ylim([-1.5 1.5]);
 saveas(h,'myPlot.png')
 saveas(h,'myPlot.eps')

Additional Tutorials

This tutorial can also be completed with scripting programming languages like Excel and Python. Click on the appropriate link for additional information and source code.


comments powered by Disqus