How to extract high-quality image from MATLAB for my research article?

조회 수: 6 (최근 30일)
Pallov Anand
Pallov Anand 2025년 4월 5일
답변: Thorsten 2025년 4월 7일
I have the following code and I want to plot x1 vs t, x2 vs t and x3 vs t in my article. How can I have a very high resolution image. What commands/code should i use for that?
clc
clear all
close all
x1(1) = 1.5;
x2(1) = -0.15;
x3(1) = 0.1;
a = 1.2;
b = 2.92;
c = 6;
t_span = 100;
dt = 0.01;
t = 0:dt:t_span;
for n = 1:length(t)
x1(n+1) = x1(n) + dt * (x2(n));
x2(n+1) = x2(n) + dt * (x3(n));
x3(n+1) = x3(n) + dt * (-c*x1(n) - b*x2(n) - a*x3(n) + x1(n)*x1(n));
end
  댓글 수: 2
Walter Roberson
Walter Roberson 2025년 4월 5일
Your x1, x2, x3 are one element longer than your t
Walter Roberson
Walter Roberson 2025년 4월 5일
clc
clear all
close all
x1(1) = 1.5;
x2(1) = -0.15;
x3(1) = 0.1;
a = 1.2;
b = 2.92;
c = 6;
t_span = 100;
dt = 0.01;
t = 0:dt:t_span;
for n = 1:length(t)-1
x1(n+1) = x1(n) + dt * (x2(n));
x2(n+1) = x2(n) + dt * (x3(n));
x3(n+1) = x3(n) + dt * (-c*x1(n) - b*x2(n) - a*x3(n) + x1(n)*x1(n));
end
plot(t, x1, t, x2, t, x3)
legend({'x1', 'x2', 'x3'})

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

답변 (2개)

Sam Chak
Sam Chak 2025년 4월 5일
Is 600 dpi good enough?
plot(t, x1, t, x2, t, x3)
ax = gca;
exportgraphics(ax, 'myPlot.png', 'Resolution', 600)
Else if you want to use the default width and match the on-screen size more closely, then try this:
sppi = get(groot, "ScreenPixelsPerInch");
exportgraphics(ax, "myPlot.png", "Resolution", sppi)

Thorsten
Thorsten 2025년 4월 7일
Print to a vector format like eps or pdf and you have an arbitrary fine resolution.

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by