0

Using Matlab, I want my output to have a decimal value in the numerator, but Matlab is automatically evaluating this into a fraction with integers in both numerator and denominator. I am using symbolic math.

This is part of the output that's relevant:

residues =

 -0.0016          
  0.0073          
  1.3684 - 1.0258i
  1.3684 + 1.0258i
 -1.5379 + 1.0363i
 -1.5379 - 1.0363i
  0.3333          


poles =

 -50.0000          
 -40.0000          
 -3.5000 + 9.3675i
 -3.5000 - 9.3675i
 -3.0000 + 9.0000i
 -3.0000 - 9.0000i
  0          

directTerms =

 []

>> residues(1) / (s - poles(1))

ans =

-16/(10305*(s + 50))

I want the answer to be displayed as

-0.0016 / (s + 50)

Is there any way that I could prevent matlab from "simplifying" my expression.

apatrick
  • 194
  • 2
  • 14

1 Answers1

2

First you'll need to write the expression as:

expr=(-16/10305)/(s + 50)

then use vpa:

vpa(expr,3)
ans =
-0.00155/(s + 50.0)
bla
  • 25,846
  • 10
  • 70
  • 101