Why won't Matlab plot anything?

538 Ansichten (letzte 30 Tage)
Josh
Josh am 29 Mär. 2012
Kommentiert: DGM am 17 Jun. 2023
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 Kommentare
777
777 am 29 Mär. 2012
are there no error reports???
Thomas
Thomas am 29 Mär. 2012
Should work.. Does
figure()
open up the figure window?

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

M
M am 29 Mär. 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 Kommentare
Yash dev
Yash dev am 15 Jun. 2023
my plot function showing that
plot script as a function is not supported what to do??
DGM
DGM am 17 Jun. 2023
Rename your script so that it doesn't conflict with the names of existing functions.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (3)

Josh
Josh am 29 Mär. 2012
I typed in figure() and now it works perfectly. Thanks for the help.
  1 Kommentar
Jing Yin
Jing Yin am 28 Mär. 2020
Thank you. It solves my problem too.

Melden Sie sich an, um zu kommentieren.


Mitchell Frisch
Mitchell Frisch am 19 Apr. 2019
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 Kommentare
atousa yazdani
atousa yazdani am 27 Apr. 2022
hasn't helped me!
Walter Roberson
Walter Roberson am 27 Apr. 2022
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.

Melden Sie sich an, um zu kommentieren.


Megat
Megat am 23 Mai 2023
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 Kommentar
DGM
DGM am 24 Mai 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.

Melden Sie sich an, um zu kommentieren.

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by