hey guys im having a problem running this code
the purpose is the anlyse a noisy signal data and find the time at which the signal reaches a percentage of the actual value
only the first conditional statement runs in the program , the other 2 wont even run
for i= 1:1:5079
if(Y(i)<=90*L2_v/100)
t90 = X(i);
end
if(Y(i)<=50*L2_v/100)
t50 = X(i)
end
if(Y(i)<=10*L2_v/100)
t10 = X(i);
end
end

 採用された回答

KSSV
KSSV 2020 年 12 月 8 日

0 投票

% case 1
idx = Y<=90*L2_v/100 ;
t90 = X(idx) ;
% case 2
idx = Y<=50*L2_v/100 ;
t50 = X(idx) ;
% case 3
idx = Y<=10*L2_v/100 ;
t10 = X(idx) ;

2 件のコメント

ali koulani
ali koulani 2020 年 12 月 8 日
i dont think i can use switch for this since all 3 cases can be valid at the same time
but i think i found the problem
KSSV
KSSV 2020 年 12 月 8 日
It is not a swtich. If you think there are values present which you gave, t90, t50, t10 will be calculated.

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeDebugging and Improving Code についてさらに検索

製品

リリース

R2020a

質問済み:

2020 年 12 月 8 日

コメント済み:

2020 年 12 月 8 日

Community Treasure Hunt

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

Start Hunting!

Translated by