Blank space when exporting figure as esp file

조회 수: 3 (최근 30일)
rustem
rustem 2023년 6월 15일
편집: rustem 2023년 6월 16일
I have a plot which i export as .eps file and put it into a .tex file. There is a problem with the ylabel which has a blank space in place of "^" symbol. How can i solve this problem. Here is the code.
figure;
plot(t, as); xlabel("t [s]"); ylabel("acceleration [m/s^{2} ]");
axis('padded')
exportgraphics(gca, "9_2.eps", Resolution=600)
hold off

답변 (1개)

Atithi
Atithi 2023년 6월 16일
Works absolutely fine in my device, I tried to create some dummy data for the variables as your code was not complete, and tried to plot it, there was no such error.
I would encorage you to restart Matlab and try that again.
Do let me know if you are still facing this error
  댓글 수: 2
rustem
rustem 2023년 6월 16일
Indeed this is the same as what i get in MATLAB figure window. But when i export the figure as an .eps file and upload it to some .eps viewer (what i use is overleaf by the way) i get the above picture which i upload in the first message. Here is the full code if you need. Not a so complicated one. I would be appreciate it if you could take a look at it.
clc; clear;
t = [0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48];
r = 1000*[18.80, 18.86, 18.95, 19.04, 19.15, 19.26, 19.38, 19.50, 19.62, 19.74, 19.87, 19.99, 20.12];
theta = [0.785, 0.779, 0.770, 0.759, 0.748, 0.735, 0.722, 0.707, 0.693, 0.677, 0.661, 0.645, 0.628];
h = 4; l = length(t);
v = @(dr, dt, r, t) sqrt(dr.^2 + (r.*dt).^2);
a = @(dr, ddr, dt, ddt, r, t) sqrt((ddr - r.*dt.^2).^2 + (r.*ddt + 2.*dr.*dt).^2);
dr = 0; dt = 0; ddr = 0; ddt = 0;
vs = zeros(l, 1);
as = zeros(l, 1);
for i = 1:l
if i == 1
dr = (-r(i+2) + 4*r(i+1) - 3*r(i)) / (2*h);
dt = (-theta(i+2) + 4*theta(i+1) - 3*theta(i)) / (2*h);
ddr = (-r(i+3) + 4*r(i+2) - 5*r(i+1) + 2*r(i)) / h^2;
ddt = (-theta(i+3) + 4*theta(i+2) - 5*theta(i+1)+2*theta(i)) / h^2;
elseif i == l
dr = -(-r(i-2) + 4*r(i-1) - 3*r(i)) / (2*h);
dt = -(-theta(i-2) + 4*theta(i-1) - 3*theta(i)) / (2*h);
ddr = -(-r(i-3) + 4*r(i-2) - 5*r(i-1) + 2*r(i)) / h^2;
ddt = -(-theta(i-3) + 4*theta(i-2) - 5*theta(i-1)+2*theta(i)) / h^2;
else
dr = (r(i+1) - r(i-1)) / (2*h);
dt = (theta(i+1) - theta(i-1)) / (2*h);
ddr = (r(i+1) -2*r(i) + r(i-1))/h^2;
ddt = (theta(i+1) -2*theta(i) + theta(i-1))/h^2;
end
vs(i) = v(dr, dt, r(i), t(i));
as(i) = a(dr, ddr, dt, ddt, r(i), t(i));
end
% figure;
% plot(t, vs); xlabel("t [s]"); ylabel("velocity [m/s]");
% axis('padded')
% exportgraphics(gcf, "9_1.eps")
figure;
plot(t, as); xlabel("t [s]"); ylabel('acceleration [m/s^2]');
axis('padded')
exportgraphics(gcf,'9_2.eps')
rustem
rustem 2023년 6월 16일
편집: rustem 2023년 6월 16일
Now i have reached a friends machine and it exported the file properly. Nothing wrong with the code. Then here is the new question. Why my machine does not export the file properly? Are there some settings which causes this issue. I am using a 22.10 ubuntu machine with R2022b academic use.

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

카테고리

Help CenterFile Exchange에서 Particle & Nuclear Physics에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by