Question

I need to substitute a value for s in a transfer function. For example:

G(s)= 1/ (s+3)

I need to substitute

s = -2.118 +2.221j

What code should I use for this?

PS: Unfortunately, I only have control system toolbox in MATLAB.

Was it helpful?

Solution

What's wrong with saving m-file with

 function g = transferFun( s )
 g = 1 ./ ( s + 3 )

And then calling the function

 >> transferFun( -2.118 + 2.221*j )

OTHER TIPS

As shai mentioned you can simply create an m file with the function.

However, if you are just doing some quick calculations here is a way to just do it on the command line. You can define an anonymous function like this:

 G = @(s) 1/(s+3)

Now you can simply call it like this:

G(-2.118 +2.221j)

Note that Matlab is case sensitive.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top