On ubuntu, plot() does not create figure

125 Ansichten (letzte 30 Tage)
Geoffrey Rogers
Geoffrey Rogers am 14 Jun. 2020
Beantwortet: Ali am 5 Jan. 2025
I just upgraded ubuntu to 20.04 and reinstalled matlab. The plot function does not create a figure window. If I create a figure window with command <figure>, a figure window does appear, but then plot() command does not a draw a plot in it.
  3 Kommentare
Geoffrey Rogers
Geoffrey Rogers am 15 Jun. 2020
Thank you Ameer for your response. Unfortunately it still doesn't plot!
Wouter Verstraelen
Wouter Verstraelen am 24 Feb. 2021
See this one: it's an annoying (but known) issue
https://www.mathworks.com/matlabcentral/answers/216942-plotting-and-opengl-error-on-linux-how-to-resolve

Melden Sie sich an, um zu kommentieren.

Antworten (2)

Gayathri
Gayathri am 19 Dez. 2024
I understand that you are facing issues in the "plot" function to generate a "figure" in MATLAB on Ubuntu OS.
Please refer to one of the below mentioned workarounds to resolve the issue.
1. Create a file named "java.opts" in the directory where MATLAB is executed (Eg: /usr/local/MATLAB/R2024b/bin/glnxa64) and include the following line.
-Djogl.disable.openglarbcontext=1
2. Run MATLAB from the terminal using the following command to override the graphics driver.
export MESA_LOADER_DRIVER_OVERRIDE=i965; matlab
3. Launch MATLAB with software OpenGL by using the following command.
matlab -softwareopengl
4. Turn off anti-aliasing for figures by setting the "GraphicsSmoothing" property to "off" .
set(gcf, 'GraphicsSmoothing', 'off');
You can also refer to the following MATLAB Answer to learn more about the workarounds.
For more information, refer to the following MathWorks Documentation to learn about ‘Resolving Low-Level Graphics Issues’.
Hope you find this information helpful.

Ali
Ali am 5 Jan. 2025
num = [1];
denum = [1 3 1];
g = tf(num, denum);
% Closed-loop system without controller
sys = feedback(g, 1);
figure;
step(sys);
drawnow;
hold on;
title('Step Responses');
xlabel('Time (seconds)');
ylabel('Amplitude');
grid on;
% PID Controller with manual gains
kp = 1;
ki = 1;
kd = 1;
p_manual = pid(kp, ki, kd);
% Closed-loop system with manual PID controller
sys_manual = feedback(p_manual * g, 1);
step(sys_manual);
% PID Tuning
p_tuned = pidtune(g, 'pid');
disp('Tuned PID Gains:');
disp(p_tuned);
% Closed-loop system with tuned PID controller
sys_tuned = feedback(p_tuned * g, 1);
step(sys_tuned);
% Add legend to distinguish responses
legend('Without Controller', 'Manual PID', 'Tuned PID');

Kategorien

Mehr zu Graphics Objects finden Sie in Help Center und File Exchange

Tags

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by