Effacer les filtres
Effacer les filtres

find the minimum value of x that corresponds to maximum value of theta

5 vues (au cours des 30 derniers jours)
George
George le 13 Fév 2013
Hello , I have :
x=30:0.5:300;
h=180;
hypot=sqrt(x.^2+h.^2);
phi=asind(h./hypot);
theta=90-phi;
Now , I want to find the minimum value of x that corresponds to maximum value of theta. How can I do this?
Thanks!
  2 commentaires
Sean de Wolski
Sean de Wolski le 13 Fév 2013
FYI, hypot() is a builtin function that does what you have above. So be careful not to overwrite it (and I recommend using it!)
x = 1:10;
y = 3
myHypot = hypot(x,y)
George
George le 14 Fév 2013
Ok, thank you!

Connectez-vous pour commenter.

Réponse acceptée

Azzi Abdelmalek
Azzi Abdelmalek le 13 Fév 2013
Modifié(e) : Azzi Abdelmalek le 13 Fév 2013
[~,idx]=max(theta)
out=x(idx)
  3 commentaires
Azzi Abdelmalek
Azzi Abdelmalek le 13 Fév 2013
How it works: Example
x=[1 2 3 4 5 6]
y=[10 20 1 21 15 2]
The maximum value of y is 21, it corresponds to index 4, which correspond in x to x(4)
[max_value,idx]=max(y)
out=x(idx)
George
George le 14 Fév 2013
Ok, thanks!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Operators and Elementary Operations dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by