Ask a matlab expert why there is an error using when you run the program

Updated on technology 2024-08-05
2 answers
  1. Anonymous users2024-02-15

    Upstairs is correct, but does not explain the reason for the error, and for beginners, although Regret solves the problem at hand, it is still possible to make similar mistakes later.

    First of all, the landlord may be confused by their own expressions.

    There is no such thing as mpower, why is it reported.

    error using ==mpower

    Such a mistake? Actually, use.

    help mpower

    If you look at the reference information of this function, you can know that mpower is a matrix power function.

    matrix power), the corresponding symbol is " " and this symbol is in the expression of the landlord.

    Here, by the way, a little background introduction: operators in MATLAB.

    In fact, there are corresponding functions, for example, "mpower", "mtimes", "mrdivide, and so on." Yes.

    help ops

    See a more detailed list of operators.

    The functions corresponding to the above operators all start with m, which means that what these operators do is matrix operation, that is, the operation is carried out according to the matrix operation rules. In contrast to matrix operations, there is another type of operation called array operation, which is commonly referred to as "point operation", and its rule is to perform operations according to the correspondence of each element, such as ". .* is the result of multiplying the corresponding positions of two elements of an array of the same dimension.

    Point operations mainly include the following:

    array multiplication, the corresponding function is times;

    The array is divided to the right, and the corresponding function is rdivide;

    array divide, the corresponding function is ldivide;

    array power, the corresponding function is power;

    Transpose, the corresponding function is transpose (if there is no grinding point, i.e., ".'" indicates conjugate transposition.

    With the above background knowledge, the landlord should know why it went wrong and how to correct it. The t in the expression is an array, and the landlord's calculation is obviously intended to be performed on each element (element-wise), so some operators should be changed to point operations. The operators involved include three """"*" and a "" "Just change it:

    f=1./(1-(1-(;

    Finally, I don't know if the landlord will have such a question: in the expression, " appears before " ", why not report the right division sign.

    Instead, the error of the power operation is reported? This is because there is a parenthesis to the right of the division sign of the expression, and to divide the operation, the value in the parentheses must first be calculated, and the first thing you will encounter when calculating the value in the parentheses is " ".

  2. Anonymous users2024-02-14

    1. In the following method description, the following example procedure is used to illustrate.

    Instance program. xx,yy] = meshgrid(1:20,1:20);

    d = sqrt(xx.^2+yy.^2);

    zz = peaks(10);

    out = d + zz;

    surf(out);shading interp;

    2After the MATLAB program runs an error, switch to the MATLAB command line, observe the error message in the command line, and determine the cause of the error.

    3. In the error message, find the number of lines of the error ** in the source program, and click the number of lines link to directly locate the error statement.

    4. After the error statement is located, it will automatically jump to the ** device, and identify the wrong ** position by the cursor in the ** device.

    5. After the error statement is determined, use the F12 shortcut key to set the breakpoint at the error statement.

    6. After the breakpoint setting is completed, re-execute the program through the F5 shortcut key, and the program will stop running at the breakpoint and enter the debugging state.

    7. There are multiple steps in the debugging state to find the cause of the program problem.

    1) Place the mouse over the variable, then the ** device will automatically display the type, number of dimensions, size of each dimension and other information of the variable, according to this information to help the programmer find the cause of the variable error in the program.

    8. There are multiple steps in the debugging state to find the cause of the program problem.

    2) Copy the problem ** line to execute in the matlab command line and reproduce the error. In this way, errors can be re-re-repeated without interrupting the program and without having to re-execute the program, improving debugging efficiency.

    9. There are multiple ways to find the cause of a program problem in the debug state.

    Commands such as whos, size, and help can be used to help determine the cause of the error. The whos command can view the list of variables in the current workspace, size can determine the number and size of each dimension of a variable, and help can determine the help information of an operator or function.

Related questions
3 answers2024-08-05

It depends on what kind of data your atkj is.

If it's a row of data: it won't be 0 if you run it by your ** >>>More

7 answers2024-08-05

Because msconfig and regedit exist in the %systemroot% pchealth helpctr binaries directory instead of %systemroot% or %systemroot% system32, you can't omit their paths and just run the filename open. >>>More

7 answers2024-08-05

The product is a large-leaf umbrella, in fact, according to your description: I suggest that you move this large-leaf umbrella to the shade of the tree outdoors for a week, the leaves dry out because of the lack of water caused by the lack of water indoors for a long time, put the plant in the shade, one is to avoid direct sunlight, and the other is to allow it to fully attract the morning dew, so that the general situation is about a week, it should be better. Hope it helps!

12 answers2024-08-05

cmd needs to load the class file before running.

5 answers2024-08-05

Whether it is installed correctly. Otherwise, it won't work. >>>More