Problem with the latex eps format

조회 수: 10 (최근 30일)
Harold Mendoza
Harold Mendoza 2020년 10월 4일
댓글: Harold Mendoza 2020년 10월 7일
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
Vladimir Sovkov
Vladimir Sovkov 2020년 10월 4일
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.

댓글을 달려면 로그인하십시오.

채택된 답변

Bjorn Gustavsson
Bjorn Gustavsson 2020년 10월 4일
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
Bjorn Gustavsson
Bjorn Gustavsson 2020년 10월 7일
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 2020년 10월 7일
thanks you so much

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Printing and Saving에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by