Plotting Transfer Functions Using Matlab

In summary, the conversation revolved around using a bode plot program with Matlab to plot transfer functions. The program provided was not working and the user was seeking alternative methods to plot the frequency response and bandwidth. They had found a solution to obtaining the zeros, poles, and gain, but were still struggling with plotting the transfer function.
  • #1
mpm
82
0
I am using a bode plot program using Matlab to try and plot transfer functions.

Here is the program I have:
http://www.swarthmore.edu/NatSci/echeeve1/Ref/Bode/BodePlotGui.html

Everytime I try and type in the command that it says to use, it gives me a tf is an unknown variable.

Does anyone know how I can get this to work?
 
Last edited by a moderator:
Physics news on Phys.org
  • #2
I figured out how to get the zeros, poles, and gain by using this:

num = [2 3];
den = [1 4 0 5];
[z,p,k] = tf2zp(num,den)

But I can't figure out how to plot this to find the frequency response and bandwidth.

Note: I am just trying to find alternatives since I can't get this other program to work. Anything that works I will use.
 
  • #3



Hi there,

Thank you for sharing your experience with using Matlab to plot transfer functions. It seems like you are encountering an error when trying to use the command for plotting transfer functions.

First, it is important to make sure that you have defined the transfer function using the correct syntax. In Matlab, transfer functions are typically defined using the 'tf' function, with the numerator and denominator coefficients as inputs. For example, if you have a transfer function with a numerator of [1 2] and a denominator of [1 3], you would define it as tf([1 2],[1 3]).

Once you have defined your transfer function, you can use the 'bode' function to plot it on a Bode plot. This function takes the transfer function as an input, along with any desired plot options. For example, if you want to plot the magnitude and phase in decibels, you can use the command bode(tf([1 2],[1 3]),'dB').

If you continue to encounter errors, it may be helpful to consult the Matlab documentation or reach out to the Matlab community for assistance. Best of luck with your transfer function plotting!
 

1. How do I plot a transfer function in Matlab?

To plot a transfer function in Matlab, you can use the tfplot() function. This function takes in the numerator and denominator coefficients of the transfer function as its arguments and plots the frequency response.

2. Can I customize the plot of a transfer function in Matlab?

Yes, you can customize the plot of a transfer function in Matlab by using the various options available in the tfplot() function. These options include changing the plot style, adding labels and titles, and adjusting the frequency range.

3. How do I add multiple transfer functions in one plot in Matlab?

You can add multiple transfer functions in one plot in Matlab by using the tfplot() function multiple times with different transfer function coefficients. Make sure to use the hold on command before plotting each function to prevent the previous plot from being erased.

4. Is there a way to analyze the stability of a transfer function in Matlab?

Yes, you can analyze the stability of a transfer function in Matlab by using the isstable() function. This function takes in the numerator and denominator coefficients of the transfer function and returns a logical value indicating whether the transfer function is stable or not.

5. Can I simulate the response of a transfer function in Matlab?

Yes, you can simulate the response of a transfer function in Matlab by using the lsim() function. This function takes in the transfer function, input signal, and time vector as its arguments and returns the output response of the transfer function.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
992
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
5K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
11
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
683
  • MATLAB, Maple, Mathematica, LaTeX
Replies
9
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
10
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
11
Views
3K
Back
Top