Search code examples
matlabsymbolic-math

Solving Exponential equation in MATLAB parametrically


i want to solve this equation...

 | 1     1     1 | |b0| |exp(t)  |
 | 0     1     2 | |b1|=|exp(t)  |
 | 1     1     1 | |b2| |exp(2*t)|

i like the answer be like this:

for example:

b0=2*exp(t)+exp(2*t) b1=exp(t)+1 b2=exp(


Solution

  • That matrix is singular, so there's no unique solution (depending on t, there may be zero or infinitely many solutions). I will replace it with an invertible matrix to demonstrate the method:

    >> A = [1,1,1;0,1,2;1,1,0]
    
    A =
    
         1     1     1
         0     1     2
         1     1     0
    

    After that, solving is a straightforward use of the symbolic capability:

    >> t = sym('t');
    >> rhs = [exp(t);exp(t);exp(2*t)]
    
    rhs =
    
       exp(t)
       exp(t)
     exp(2*t)
    >> b = A\rhs
    
    b =
    
       exp(t) - exp(2*t)
     2*exp(2*t) - exp(t)
       exp(t) - exp(2*t)