In this blog, I will give a basic MATLAB tutorial on plotting and how to use BibTex in LaTeX. In addition, I show how to insert the MATLAB figure into Overleaf.

This video was made from my recent teachings of a first-year advanced mathematics course where there was a need to show students how to make nice plots and referencing for their reports. I hope you enjoy the tutorial if you are interested.

YouTube Video

MATLAB Code

% this script is a basic tutorial on making nice 
% plots in matlab using a linear function as an 
% example
% 
% Kai Li
% 29 April 2024

clear % clear your workspace
close all % close all figure window 
clc % clear command window 

% define domain to plot
x = 0:0.01:10;

figure('Position',[500,500,350,300])
for ii = 1:10
    hold on
    plot(x,x+ii,'LineWidth',2)
end

xlabel("$x$",'FontSize',18,'Interpreter','latex')
ylabel("$y$",'FontSize',18,'Interpreter','latex')
box on

exportgraphics(gcf,'linear-plot.pdf','ContentType','vector')

Please refer to the video for the LaTeX instructions in the Overleaf demo.