Clear Filters
Clear Filters

Blank space when exporting figure as esp file

1 view (last 30 days)
rustem
rustem on 15 Jun 2023
Edited: rustem on 16 Jun 2023
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

Answers (1)

Atithi
Atithi on 16 Jun 2023
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 Comments
rustem
rustem on 16 Jun 2023
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 on 16 Jun 2023
Edited: rustem on 16 Jun 2023
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.

Sign in to comment.

Categories

Find more on Graphics Object Properties in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!