User Tools

Site Tools


matlab

This is an old revision of the document!


Matlab

These lines of code help make a better looking plot that can be exported for a notebook or a publication.

x=[0:1:50];
y=2*sin(x/5);
figure('units','centimeters','Position', [10 10 8.5 8.5]) %this makes a single-column figure (width 8.5cm)
plot(x,y,'LineWidth',1.1); %linewidth 1.1 makes curve slightly thicker than default
axis([0 50 0 3])
xlabel('wavelength, ') 
ylabel('intensity') 
set(gca,'linewidth',1.1)  %linewidth 1.1 makes axis slightly lines thicker than default
set(gca,'FontSize',10) %when the graph is scale to 8.5cm width, the font will be 10 point.

Additional pointers about graphs on Matlab.

  • From the menus associated with the figure, go to “file > export setup > rendering”, and set the resolution to 300 dpi (“apply to figure”).
  • From the menus associated with the figure, go to “file > save as”, and save as a png file. png is much better than jpg for line graphics.
matlab.1716504701.txt.gz · Last modified: 2024/05/23 15:51 by ethanminot