How to describe function with varying variables?

4 ビュー (過去 30 日間)
Abdirahman Mohamed
Abdirahman Mohamed 2020 年 10 月 1 日
回答済み: Asad (Mehrzad) Khoddam 2020 年 10 月 1 日
I am trying to understand how one can describe a function in matlab like the one in the picture
Would this be wrong? if not is there a better way to neatly describe a function with, in this case, a varying t value.
if t<=L/v
h=(H/2)*(1-cos((2*pi*v*t)/L));
elseif t>L/v
h=0;
end

回答 (1 件)

Asad (Mehrzad) Khoddam
Asad (Mehrzad) Khoddam 2020 年 10 月 1 日
You can multiply the first equation by a vector that is 1 for t<=L/v and is zero when t>L/v
h=(H/2)*(1-cos(2*pi*v*t/L)).*( t<= L/v);

カテゴリ

Help Center および File ExchangeGet Started with MATLAB についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by