Effacer les filtres
Effacer les filtres

Value must be a 1x2 vector of numeric type in which the second element is larger than the first and may be inf

32 vues (au cours des 30 derniers jours)
I do not understand why the plot don't work in this interval!!!!
interval=[0 10];
x=0:0.1:10;
y=@(x) 1/x;
set(gca, 'XLim', interval, 'YLim', [y(interval(1)) y(interval(2))] );
  1 commentaire
Jos (10584)
Jos (10584) le 4 Avr 2019
Modifié(e) : Jos (10584) le 4 Avr 2019
Did you check what [y(interval(1)) y(interval(2))] returns? Do you think this is a valid Y limit?

Connectez-vous pour commenter.

Réponses (1)

Alex Mcaulley
Alex Mcaulley le 4 Avr 2019
Modifié(e) : Alex Mcaulley le 4 Avr 2019
Use fplot:
interval=[0 10];
y=@(x) 1/x;
fplot(y,interval)
  3 commentaires
Alex Mcaulley
Alex Mcaulley le 4 Avr 2019
This code works, clear your workspace and run the above code

Connectez-vous pour commenter.

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by