How do I write an if statement that says a variable is a error given a condition?
古いコメントを表示
Please how do I write this 'if statement' in MATLAB notation? I ran a simulation N times and would like to find the error rate using an 'if statement'. I ran the simulation N number of times. How do I write that Y is an error if the statement below happens? And then calculate the errors in N number of trials?
if X=1.2||Y=0 && U1>U2
%How do I write that Y is an error if the above statement happens? And then calculate the number of errors in N number of trials?
end
10 件のコメント
madhan ravi
2019 年 2 月 7 日
size(U1)
size(U2) %?
Temi O
2019 年 2 月 7 日
Walter Roberson
2019 年 2 月 7 日
Do you want
(x1(i) == a || x2(i) == 0) && U1 > U2
or
x1(i) == a || (x2(i) == 0 && U1 > U2)
?
Temi O
2019 年 2 月 7 日
Walter Roberson
2019 年 2 月 7 日
I am not clear as to whether an error should be counted if x1(i) == a but x2(i) is not 0 ?
Temi O
2019 年 2 月 7 日
Walter Roberson
2019 年 2 月 7 日
Is there are point in testing x1(i) == a then? You only count errors if x2(i) == 0 & U1 > U2 and you count those no matter what the value of x1(i) is.
Temi O
2019 年 2 月 8 日
Temi O
2019 年 2 月 8 日
Kevin Phung
2019 年 2 月 8 日
Did my answer below not give you an idea of how to increment the errorsCount?
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Startup and Shutdown についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!