How can I impose restrictions on a function @
1 回表示 (過去 30 日間)
古いコメントを表示
Dear all
I have a compicated function
logPDF=@(x) set_up(x, a,y);
under the restriction x+a<0.999.
How can I impose this restriction on the above function? Do I need to set up another function? Can I impose the restrctions inside the set_up function?
5 件のコメント
James Tursa
2020 年 6 月 5 日
Just a simple if-test up front to throw an error if the desired condition is not met.
Mohammad Sami
2020 年 6 月 5 日
You can use assert function to check the condition is met, otherwise it will throw an error.
assert((x+a)<0.999,'Error message you want to display / throw');
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Image Processing Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!