How to define if variable with one unknown parameter

10 ビュー (過去 30 日間)
Tor Berge
Tor Berge 2015 年 3 月 7 日
コメント済み: Star Strider 2015 年 3 月 7 日
Hi,
Working with the JONSWAP spectrum, with an unknown frequency f and a known frequency fp
Sigma value is depending on the relation between f and fp.
If f is smaller or equal to fp, then sigma = 0.07
If f is larger than fp, then sigma = 0.09
Could someone explain how to perform this is in Matlab?

採用された回答

Star Strider
Star Strider 2015 年 3 月 7 日
編集済み: Star Strider 2015 年 3 月 7 日
The easiest way:
sigmafun = @(f,fp) [(f <= fp)*0.07 + (f > fp)*0.09];
sigma1 = sigmafun(1,2) % Test Calls
sigma2 = sigmafun(2,1)
sigma3 = sigmafun(3,3)
  2 件のコメント
Tor Berge
Tor Berge 2015 年 3 月 7 日
Thank you @Star Strider.
Star Strider
Star Strider 2015 年 3 月 7 日
My pleasure!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeOctave についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by