フィルターのクリア

define a piecewise function whose parameters change on each segment

2 ビュー (過去 30 日間)
hosein Javan
hosein Javan 2018 年 5 月 27 日
コメント済み: hosein Javan 2018 年 5 月 27 日
hello I,m trying to write a code to define this piecewise function. the function contains two sub-functions:
v_on(A,B,t) = (define function)
v_off(A,B,t) = (define function)
A & B are parameters given in a matrix and depend on time interval. for example:
A=[1 3 5 2 7]
B=[1 5 8 4 9]
the boundaries which define the time intervals are given in a vector. for example:
tb=1e-3*[1 3 4 5 7]
ok now we must calculate this function:
V(t)=v_on(A(1),B(1),t) if tb(1)<t<tb(2)
V(t)=v_off(A(2),B(2),t) if tb(2)<t<tb(3)
V(t)=v_on(A(3),B(3),t) if tb(3)<t<tb(4)
and so on. I could do it using loops and it works fine. but the code is too complex that if I want to change a few parameters I'd have to review it all over. I was wondering it would be definitely possible by using matrices and arrays.

回答 (1 件)

Abraham Boayue
Abraham Boayue 2018 年 5 月 27 日
  1 件のコメント
hosein Javan
hosein Javan 2018 年 5 月 27 日
I forgot to mention that A,B and tb are very long vectors. the method in the link defines a small number of interval piecewise but here we are dealing with a large number of intervals. thanks for answering.

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

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by