フィルターのクリア

Any idea on how to build this function?

2 ビュー (過去 30 日間)
Alessandro Longo
Alessandro Longo 2017 年 11 月 24 日
コメント済み: Alessandro Longo 2017 年 11 月 24 日
Hello forum, I should build a MATLAB function that will plot the red function:
In particular, I know the f0 frequency so: - the first period is T0=1/f0, and I want that from 0 to T0 the frequency is fixed at level f0; - than the frequency passes to f1=f0+k*T0 (k is a known constant) and the period is T1=1/f1 and so on.
Do you have any idea on how to build it?

回答 (2 件)

M
M 2017 年 11 月 24 日
basic idea, to adapt to your specific case :
t=20:-1:1;
stairs(1./t)
which gives
  1 件のコメント
Alessandro Longo
Alessandro Longo 2017 年 11 月 24 日
Unfortunately this is not a good solution because I should implement the code in a Matlab-fcn block for a Simulink model (so I need something like a for/while cycle that will generate this function with time increasing)

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


Andrei Bobrov
Andrei Bobrov 2017 年 11 月 24 日
Let T - your T0,T2 and etc. (T = [T0,T1,...,TN]);
f - your f0,f1 and etc. (f = [f0,f1,...fN]).
function F = yourfreq(t,T,f)
ii = discretize(t,[0, T]);
F = f(ii);
end
  1 件のコメント
Alessandro Longo
Alessandro Longo 2017 年 11 月 24 日
This function requires as input three parameters, while I have only the frequency f0

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

カテゴリ

Help Center および File ExchangeConditional Mean Models についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by