Saturday, 15 September 2012

math - Reducing equations using R -


I got this small snippet to reduce a large system:

  # Set up Multiplier g1 = (s + 9) / (s) * (s + 6) * (s + 12) * (s + 14)) g2 = ((6) * (s + 9) * (s + 17)) / / ((S + 12) * (s + 32) * (s + 68)) h1 = 13 h2 = 1 / (s + 7) # System s1 = (g2) / (1 + (g2 ) * (H1)) S2 = (S1) * (G1) S3 = (S2) / (1 + (S2) * (H2)) # Now we have Unity Response G = S 3 Show (g)  

g should low operation should be done with the above action However, when I run the code The I get a bunch of errors:

  error: object 'not found' error: object 'not found error: object' not found error: object 'g2' not found Error: object 's1 'Not found error: object' s2 'not found error: object' 3 'not found error: error in evaluating argument' object 'in the method to select function' show ': Error: object' g 'was not found  

am I Although I am not correctly using equations?

Edit: As my intent should be s free variable

To evaluate your first line of code, one object must be s it is already defined.

It seems that your goal is to create a function that outputs an input s to g . make_g :

  make_g & lt; - Function (s) {# Multipliers to set up g1 = (9 + 9), / (S) * (S +6) * (S +12) * (S +14)) G2 = (( 6) * (S + 9) * (S + 17)) / ((S + 12) (S + 32) * (s + 68)) h1 = 13 h2 = 1 / (s + 7) # System s1 = (G2) / (1 + (g2) * (h1)) in s2 = (S1) * (g1) s3 = (s2) / (1 + (s2) * (h2)) now we have unity feedback = S3g}  

Now, you can call the function using whatever value for s :

  Make_g (s = 1)  

No comments:

Post a Comment