I click "Open" button ,but there is no response,why ?

3 views (last 30 days)
I run the simulink and there is a error.
Usually, when I click the button ,it will leads to me where the error exists ,but I click the button ,there is no response .
I know I cannnot squareroot(-2i) ,but i cannot find which sqrt is not correct.
I use MATLAB fcn in the simulink , the followings codes contains sqrt():
polynomial =sqrt( 1- ((backRatio - b)/(1-b))^2 ); //it is definitely positive!
What should I do ?
  1 Comment
Walter Roberson
Walter Roberson on 21 Mar 2025
At the moment, we have no reason to know that (backRatio - b)/(1-b) is definitely in the range [-1 1]

Sign in to comment.

Answers (1)

Rahul
Rahul on 21 Mar 2025
Hi @Mi Li,
As I understand, you are trying to evaluate a 'polynomial' variable in a MATLAB Function block in your Simulink model which using the 'sqrt' function. The current error appears as the 'sqrt' function is unable to evaluate a negative integer and suggests that using 'complex' function along with the 'sqrt' function can be useful.
I tried to reproduce the error at my end by using dummy values and was able to do so. However, on using the 'complex' function with 'sqrt' function I was able to resolve the error in the following way:
function y = fcn(u)
y = sqrt(complex(1- ((backRatio - b)/(1-b))^2));
end
The following MATLAB Answer can also be referred for this:
I also faced the issue regarding unresponsive 'Open' button in the diagnostic viewer in MATLAB R2018a version. This behaviour would definitely be considered unexpected and I could not find a workaround for this directly.
After upgrading to recent MATLAB versions, I observed that 'Open' button was removed from the diagnostic viewer error panel. Instead, information related to the error i.e. which line it occurs at as well as the hyperlink for it is directly mentioned in the error message itself. Here is an example:
Note: I am using MATLAB R2024b version, however the above shown error message has been available from R2020 releases.
The following MathWorks documentations can be referred to know more:
Hope this helps! Thanks.

Categories

Find more on Modeling in Help Center and File Exchange

Products


Release

R2018a

Community Treasure Hunt

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

Start Hunting!