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

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 件のコメント

Sean de Wolski
Sean de Wolski 2013 年 2 月 13 日
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 2013 年 2 月 14 日
Ok, thank you!

サインインしてコメントする。

 採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 2 月 13 日
編集済み: Azzi Abdelmalek 2013 年 2 月 13 日

0 投票

[~,idx]=max(theta)
out=x(idx)

3 件のコメント

George
George 2013 年 2 月 13 日
Can you explain me how this works?Also, if i try to change phi=asin(..) and not 'asind' according to your solution i still take the same results.Shouldn't be different?Thank you.
Azzi Abdelmalek
Azzi Abdelmalek 2013 年 2 月 13 日
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 2013 年 2 月 14 日
Ok, thanks!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File Exchange で Language Fundamentals についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by