Problem with the latex eps format

20 visualizaciones (últimos 30 días)
Harold Mendoza
Harold Mendoza el 4 de Oct. de 2020
Comentada: Harold Mendoza el 7 de Oct. de 2020
Hello friends, I would like you to help me, I am using the 2020 trial version of matlab, I want to make a report in latex but when importing the graphics in .eps format in the latex document they come out pixelated. I would like you to give me some help since when I used matlab 2016 the graphs turned out well.
matlab codeph:
num=[1 5 -5 0 19]
den=[1 5 1 1 1 -4]
f=tf(num,den)
rlocus(f)
  1 comentario
Vladimir Sovkov
Vladimir Sovkov el 4 de Oct. de 2020
It is strange but you are right indeed. In the matlab window, the curves look to be vectorized, but after exporting to eps or svg they become pixelated. It never happened when I created plots with the plot command, etc. On the other hand, eps files are allowed to contain bitmap images, and you can insert them into the latex document anyway. I have no idea what else can be done.

Iniciar sesión para comentar.

Respuesta aceptada

Bjorn Gustavsson
Bjorn Gustavsson el 4 de Oct. de 2020
When you write to postscript-format matlab (still) makes "clever" choises about how to write the file. Try to enforce vectorized format by invoking the painters renderer:
print -depsc2 -painters Your_file-01.eps
or:
print('-depsc2','-painters','Your_file-01.eps')
Otherwise print might use the -opengl renderer.
HTH
  4 comentarios
Bjorn Gustavsson
Bjorn Gustavsson el 7 de Oct. de 2020
You have to do some work, I'm afraid. In my long-work-scripts I typically have snippets something like this:
%At the top of the script I have define directives-variables
print_figs = 1; % or zero to not plot figures, or even an array of ones and zeros...
% Then I typically have a run-index saved in a project-specific mat-file:
load('thisproject.mat',run_idx)
run_idx = run_idx + 1; % that I increment
save('thisproject.mat','run_idx','-append')
% Then in the script for each figure I have:
if print_figs
print('-depsc2','-painters',sprintf('Figures/this-fig-name-%03d.eps',run_idx))
end
That becomes a simple process of copy and paste when modifying, so not that bothersome.
You could write yourself a function that does something similar, perhaps something like this:
function thatwentok = print_another_eps_figure()
load('fignumber.mat',idx)
idx = idx+1;
save('fignumber.mat','idx')
print('-depsc2','-painters',sprintf('next-fig-%04d.eps',idx))
end
Then you'd only have to run that function and the figures will be saves with incremental names. But this convenience, I think, will not benefit you that much in the long run because one thing you will want to do is to re-do your figures, and that is very much helped by having scripts/functions that you can run and reproducibly repeat the tasks. But, maybe it is worth it.
Harold Mendoza
Harold Mendoza el 7 de Oct. de 2020
thanks you so much

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Printing and Saving en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by