Receiving different results from custom function depending on input

3 ビュー (過去 30 日間)
Marc Laub
Marc Laub 2022 年 10 月 18 日
コメント済み: Chetan 2023 年 8 月 29 日
Hey guys,
I have a function which is basically just a concatenation of polynoms, log-terms... i handles 3 input variables and gives out a scalar and is fully vectorized, so it can handle 3 seperate input vectors and give a vector as results.
When sweeping over all 3 input variables, for specific combinations of the input variables, the results will be "NaN" wether it will be a real number, when the same combination is put in manually in the command window.
Same happens when I sweep over all 3 variables, but wanna see the results only for the indices, where 2 of the 3 variables are kept constant. Also in this case the results are all NaN, wether the results optained when only sweeping over 1 variable, and keeping the other 2 at the same constant value (so same input) are real numbers.
I double checked that every *, / and ^ is replaced by .*, ./ and .^ so that the error should not come from there.
I am completely lost at this point why the results should differ depending on if the input is in the command window or skrip or if I do the whole input and just look at specific indexes of the result, ot if I only take the same index as input...
Anybody observed something similar?
Many thanks in advance
  1 件のコメント
Chetan 2023 年 8 月 29 日
Hi @Marc Laub can you share the code which you are facing the issue.


回答 (0 件)


Help Center および File ExchangeMatrix Indexing についてさらに検索




Community Treasure Hunt

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

Start Hunting!

Translated by