Inputting Transfer Functions in MATLAB - Rob's Guide

In summary, to input transfer functions in MATLAB, you can use the tf function. You can also input multiple transfer functions at once by creating a transfer function object for each one and storing them in a cell array. To plot the Bode plot of a transfer function, you can use the bode function. To convert a transfer function to a state-space representation, you can use the tf2ss function. You can also combine multiple transfer functions using the series and parallel functions.
  • #1
rc flyer uk
11
0
I have only basic MATLAB skills and need to input to transfer functions into MATLAB to determine a closed loop transfer function! But cannot find any simple books or guides to show me how to input the functions! One of the transfer functions i wish to input is:

G(p)=1/s(1+0.8+0.04s^2)

Some help of the method of inputing this, would be greatly apricated!

Cheers
Rob
 
Physics news on Phys.org
  • #2
A=tf([1],[0.04 0.8 1])

If you want the root locus just type in

rlocus(A)

Your system appears to always be stable and in the LHP for all positive values of gain K.
 
Last edited:
  • #3


Hi Rob,

Thank you for reaching out for help with inputting transfer functions in MATLAB. I completely understand your struggle in finding a simple guide to help you with this task. Luckily, there are a few steps you can follow to input your transfer function and determine the closed loop transfer function in MATLAB.

Step 1: Define your transfer function

Before inputting the transfer function in MATLAB, you need to define it. In your case, the transfer function is already defined as G(p)=1/s(1+0.8+0.04s^2).

Step 2: Create a transfer function object

In MATLAB, you can create a transfer function object using the "tf" command. The syntax for this command is "tf(num, den)", where num represents the numerator coefficients and den represents the denominator coefficients of your transfer function. In your case, the command would be:

G = tf([1], [1 0.8 0.04])

Step 3: Calculate the closed loop transfer function

To calculate the closed loop transfer function, you can use the "feedback" command in MATLAB. The syntax for this command is "feedback(sys1, sys2)", where sys1 and sys2 are the transfer function objects of your open loop system and feedback loop system, respectively. In your case, the command would be:

Gclosed = feedback(G, 1)

Step 4: View the result

To view the closed loop transfer function, you can use the "tfdata" command in MATLAB. The syntax for this command is "tfdata(sys)", where sys is the transfer function object you want to view. In your case, the command would be:

tfdata(Gclosed)

This will give you the coefficients of the closed loop transfer function in the form of a cell array.

I hope this helps you input and determine the closed loop transfer function in MATLAB. If you need further assistance, I recommend checking out online tutorials and resources or reaching out to the MATLAB community for help. Best of luck!
 

1. How do I input transfer functions in MATLAB?

To input transfer functions in MATLAB, you can use the tf function. This function takes in the numerator and denominator coefficients of the transfer function in the form of vectors and creates a transfer function object. For example, if your transfer function is G(s) = (s+2)/(s^2+3s+1), you can input it as G = tf([1,2],[1,3,1]).

2. Can I input multiple transfer functions at once in MATLAB?

Yes, you can input multiple transfer functions at once in MATLAB. You can use the tf function to create a transfer function object for each transfer function, and then store them in a cell array. For example, if you have two transfer functions G1(s) = 1/s and G2(s) = 2/(s+1), you can input them as G = {tf([1],[1,0]), tf([2],[1,1])}.

3. How do I plot the Bode plot of a transfer function in MATLAB?

To plot the Bode plot of a transfer function in MATLAB, you can use the bode function. This function takes in the transfer function object as an input and plots the magnitude and phase response on a logarithmic scale. For example, if you have a transfer function G(s) = 1/(s+2), you can plot its Bode plot as bode(G).

4. How do I convert a transfer function to a state-space representation in MATLAB?

You can convert a transfer function to a state-space representation in MATLAB using the tf2ss function. This function takes in the transfer function object as an input and returns the state-space representation in the form of matrices A, B, C, and D. For example, if you have a transfer function G(s) = 1/(s+2), you can convert it to state-space representation as [A,B,C,D] = tf2ss(G).

5. Can I combine multiple transfer functions in MATLAB?

Yes, you can combine multiple transfer functions in MATLAB using the series and parallel functions. The series function multiplies two transfer functions, while the parallel function adds them. For example, if you have two transfer functions G1(s) = 1/s and G2(s) = 2/(s+1), you can combine them as G = series(G1,G2) or G = parallel(G1,G2).

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
4
Views
542
  • Engineering and Comp Sci Homework Help
Replies
16
Views
945
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
3K
  • Engineering and Comp Sci Homework Help
Replies
5
Views
1K
  • Set Theory, Logic, Probability, Statistics
2
Replies
54
Views
3K
Replies
4
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
Back
Top