Why does this piece of code fail in Scilab?
N=1000;
U=rand(N, 1);
X=(9*U - 1)^(1/3);开发者_运维百科
histplot(200, X);
Most likely the code fails because X is not real. This can happen if U is smaller than 1/9, which means that you take the third root of a negative number.
You can find problematic values of U by checking for whether the values in X are real.
Is there a '.' per element operator missing?
X=(9*U - 1).^(1/3);
EDIT:
As Jonas points out Scilab histplot won't accept complex values as argument. MATLAB on the other hand fails because of the missing 'per element' operator.
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论