Conditional Data Selection/Separation
1 回表示 (過去 30 日間)
古いコメントを表示
Hi, I have this question, kindly answer it:
PROBLEM STATEMENT:
1- My function has three variables-F,k and X.
2- I need to evaluate the function, f(F,k,X), 10,000 times to get outputs.
3- The variables F, k and X are random. They combine in many different ways to give the outputs.
4- I am only interested in those values that combine to satisfy this condition : f(F,k,X)<1.267.
5- I need to Matlab to separate these values and the corresponding output, f(F,k,X)<1.267.
I have simulation data for F, k, and X, I have computed the outputs, f(F,k,X), and f(F,k,X)<1.267 as well (each 10,000 times). I saved these 5 columns of data in a file named : 'Simd'
I went like this:
Simd;
F=Simd(:,1);
k=Simd(:,2);
X=Simd(:,3);
f(F,k,X)=F.*k.*X
if (f(F,k,X)<1.267)
M=[F k X f(F,k,X)<1.267];
end
My question is in the last three statements, please how do i get a the vector M containing values of F k and X satisfying f(F,k,X)<1.267 in a single file, that is in tabular form? Please what is the problem with my approach? Cheers.
0 件のコメント
採用された回答
Oleg Komarov
2012 年 6 月 5 日
I suggest to read the Language Fundamentals and specifically Matrices and Arrays > Indexing > Matrix Indexing
idx = Simd(:,4) <1.267;
Simd(idx,1:4)
Thus, you don't need loops of if statements.
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Loops and Conditional Statements についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!