MATLAB Solving equations problem

后端 未结 5 1214
感情败类
感情败类 2021-01-25 17:32

I want to solve these equations using MATLAB and I am sure there is a non zero solution. The equations are:

0.7071*x            + 0.7071*z = x 
  -0.5*x +         


        
5条回答
  •  一个人的身影
    2021-01-25 17:59

    I don't think you need to use the solve function as your equations is a system of linear equations.

    Recast as a matrix equation:

    Ax = B
    

    In your case:

        | -0.2929   0.0      0.7071  |  | x |     | 0 |
        | -0.5     -0.2929   0.5     |  | y |  =  | 0 |
        | -0.5     -0.7071  -0.5     |  | z |     | 0 |
    

    Use the built-in functionally of MATLAB to solve it. See e.g. MATLAB: Solution of Linear Systems of Equations.

    The core of MATLAB is to solve this kind of equation.


    Using FreeMat (an open-source MATLAB-like environment with a GPL license; direct download URL for Windows installer):

       A = [ -0.2929 0.0 0.7071; -0.5 -0.2929 0.5; -0.5 -0.7071 -0.5 ]
    
       B = [0.0; 0.0; 0.0]
    
       A\B
    
       ans =
        0
        0
        0
    

    So the solution is: x = 0, y = 0, z = 0


    The solution can also be derived by hand. Starting from the last two equations:

        -0.5*x + 0.7071*y +    0.5*z = y
        -0.5*x - 0.7071*y +    0.5*z = z
    
        0.2929*y =  -0.5*x + 0.5*z
        0.7071*y =  -0.5*x + 0.5*z
    
        0.2929*y = 0.7071*y
    

    Thus y = 0.0 and:

        0.7071*y =  -0.5*x + 0.5*z
    
        0 =  -0.5*x + 0.5*z
    
        0 =  -0.5*x + 0.5*z
    
        0.5*x = 0.5*z
    
        x = z
    

    Inserting in the first equation:

        0.7071*x + 0.7071*z = x 
    
        0.7071*x + 0.7071*x = x 
    
        1.4142*x = x 
    

    Thus x = 0.0. And as x = z, then z = 0.0.

提交回复
热议问题