Defining a Variable Ranging from One Value To Another

13 vues (au cours des 30 derniers jours)
Alex Reyes
Alex Reyes le 13 Déc 2020
Commenté : Alex Reyes le 13 Déc 2020
Hello! I'm new to MATLAB and need to define a variable, x, ranging from 0 to 2pi so I can evaluate a function at an arbitrary x-value in that range. Thank you!

Réponse acceptée

John D'Errico
John D'Errico le 13 Déc 2020
Modifié(e) : John D'Errico le 13 Déc 2020
You really need to read the basic tutorials. You cannot define a variable that is restricted to live in a specific interval.
Are you really asking how to limit the set of values a variable will take when you write a function? Or are you asking how to create a vector of variables that ranges over some interval. This requires nothing more than linspace.
  1 commentaire
Alex Reyes
Alex Reyes le 13 Déc 2020
I was asking about the latter. Thank you.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by