Why won't Matlab plot anything?

When I try to plot anything, nothing comes up. There are no errors, there's just nothing.
>> x=-10:.1:10;
>> y=sin(x);
>> plot(x,y);
No figure window pops up.

2 Commenti

777
777 il 29 Mar 2012
are there no error reports???
Thomas
Thomas il 29 Mar 2012
Should work.. Does
figure()
open up the figure window?

Accedi per commentare.

 Risposta accettata

M
M il 29 Mar 2012
You may have previous plot open somewhere and Matlab is plotting it on the same figure. Check for open figures, you might find it.
Alternatively, Use "close all" at the beginning and try again.
close all
x=-10:.1:10;
y=sin(x);
plot(x,y);

10 Commenti

Josh
Josh il 29 Mar 2012
There's still nothing. I haven't gotten a single plot to come out at all. I assume it's something to do with my preferences, as it's newly installed, but I can't find anything.
Sivan Fox
Sivan Fox il 21 Gen 2020
This worked for me though after some 15 minutes getting mad at my computer. Thanks you!
Thanks
I have got almost the same problem. A plot window showes op, but theres nothing on it... No errors showing up...
close all
clear all
M=10
x=-pi:0.01:pi;
grid on
plot (x,(sin(x*(M+(1/2))))/(sin(x/2)))
Han Yan
Han Yan il 14 Feb 2021
wow it works for me too! thanks!
plot (x,(sin(x*(M+(1/2))))./(sin(x/2)))
^
thanks...;)
LUKA
LUKA il 11 Nov 2022
legend
Yash dev
Yash dev il 15 Giu 2023
my plot function showing that
plot script as a function is not supported what to do??
DGM
DGM il 17 Giu 2023
Rename your script so that it doesn't conflict with the names of existing functions.

Accedi per commentare.

Più risposte (4)

Josh
Josh il 29 Mar 2012

2 voti

I typed in figure() and now it works perfectly. Thanks for the help.
Try adding a line style to your plot function, such as
plot(x, y 'b-')
I've had a similar problem and this fixed it for me

2 Commenti

hasn't helped me!
You do not appear to have posted your code, which makes it difficult for us to tell you how to repair it. It is not at all productive for us to list all of the different ways that can possibly lead to a plot not working as expected.

Accedi per commentare.

Megat
Megat il 23 Mag 2023

0 voti

q=5; s=0.002; b=20; n=0.03;
g=@(f) ((s*sqrt)*(b*h)^(5/3))/(n*(b+2*h)^(2/3))-q;
fplot(g,[0 1]), grid, xlabel('f'), ylabel('g(f)')
why it show nothing

1 Commento

DGM
DGM il 24 Mag 2023
You should get an error message that tells you why.
You created g as a function of f, but not only is it invariant on f, it's a function of h, which is undefined.

Accedi per commentare.

Sanjay
Sanjay il 7 Feb 2025

0 voti

I use ubuntu operating system. For opening Matlab R2024b I run "/home/user/Documents/MatLab/bin/matlab" as matlab is installed in the "Documents/MatLab" folder. Now for opening plots just add "-softwareopengl" to it. So as a whole the code is "/home/sanjay/Documents/MatLab/bin/matlab -softwareopengl"

Tag

Richiesto:

il 29 Mar 2012

Risposto:

il 7 Feb 2025

Community Treasure Hunt

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

Start Hunting!

Translated by