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 Center および File ExchangePrinting and Saving についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by