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

6 vues (au cours des 30 derniers jours)
Pallov Anand
Pallov Anand le 5 Avr 2025
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 commentaires
Walter Roberson
Walter Roberson le 5 Avr 2025
Your x1, x2, x3 are one element longer than your t
Walter Roberson
Walter Roberson le 5 Avr 2025
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'})

Connectez-vous pour commenter.

Réponses (2)

Sam Chak
Sam Chak le 5 Avr 2025
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 le 7 Avr 2025
Print to a vector format like eps or pdf and you have an arbitrary fine resolution.

Catégories

En savoir plus sur Migrate GUIDE Apps dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by