How to measure the transfer function in Simulink?

In summary: Try changing solver. Now you are using ODE45, but other might be better for this system of equations.
  • #1
jean28
85
0
Let's say I simulate a simple filter in simulink and I want to see the transfer function graph (bode plot) of it. What do I do to get Vout/ Vin? I tried using the "PS Divide" Block and divide the output voltage and the input voltage, but that didn't work. Could anyone help me out here?

This is what I tried:

http://i1226.photobucket.com/albums/ee410/jean28x/bode1.jpg

This is the graph I got:

http://i1226.photobucket.com/albums/ee410/jean28x/bode2.jpg

Thank you all very much.
 
Engineering news on Phys.org
  • #2
The scale on your scope is way of. Hit the button next to the printer and uncheck the box saying something like "save only last 1000 data points". Simulate again and hit the button with the binoculars. Does the result seem to be correct now? Check with your analytical answer!

If no results appear, check the Matlab command window for warnings and errors. A divide block can cause problems for certain inputs.

Also this setup does not create the bode plot of the system. A bode plot is the frequency response, here you got only one frequency.

Further hints: A system can create a phase shift between the input and output. Comparing the input and output at the same instant of time gives no true information about the attenuation. How is this done in your model...
 
  • #3
SirAskalot said:
The scale on your scope is way of. Hit the button next to the printer and uncheck the box saying something like "save only last 1000 data points". Simulate again and hit the button with the binoculars. Does the result seem to be correct now? Check with your analytical answer!

If no results appear, check the Matlab command window for warnings and errors. A divide block can cause problems for certain inputs.

Also this setup does not create the bode plot of the system. A bode plot is the frequency response, here you got only one frequency.

Further hints: A system can create a phase shift between the input and output. Comparing the input and output at the same instant of time gives no true information about the attenuation. How is this done in your model...

Ok thanks a lot! One more quick question. I am trying to simulate this circuit (quite complicated) and I can't seem to get an output signal that seems sinusoidal. I think it has something to do with the Refine factor, because when I simulate simpler circuits I DO get a good sine wave. Do you have any idea why this would act this way?

Circuit:

http://i1226.photobucket.com/albums/ee410/jean28x/finalproyect.jpg

Graph I get (instead of Sine Wave):

http://i1226.photobucket.com/albums/ee410/jean28x/simulinkpic3.jpg
 
  • #4
Try changing solver. Now you are using ODE45, but other might be better for this system of equations.

http://www.mathworks.se/help/simulink/ug/choosing-a-solver.html
 
  • #5


To measure the transfer function in Simulink, you can use the "Linear Analysis Tool" which is part of the Control System Toolbox. This tool allows you to analyze the linear characteristics of your system, including the transfer function. To use this tool, you need to first create a Simulink model of your system and then open the Linear Analysis Tool from the "Apps" tab in the Simulink window. From there, you can specify the inputs and outputs of your system and run the analysis. The tool will then display the transfer function, Bode plot, and other relevant information for your system. You can also use the "Bode Plot" block from the Simulink library to directly plot the transfer function of your system. This block takes in the input and output signals and automatically calculates the transfer function and plots the Bode plot. I would recommend using these tools instead of the "PS Divide" block, as they are specifically designed for this purpose and will provide more accurate results.
 

Related to How to measure the transfer function in Simulink?

1. How do I create a transfer function in Simulink?

To create a transfer function in Simulink, you can use the Transfer Fcn block from the Simulink library. This block allows you to specify the transfer function coefficients and input and output variables. You can also use the Transfer Fcn block to import transfer functions from other sources.

2. How do I simulate a transfer function in Simulink?

To simulate a transfer function in Simulink, you can use the Transfer Fcn block along with other blocks such as a Step or Sine Wave block to provide input signals. You can then use the Scope block to visualize the output of the transfer function over time. Make sure to properly set the simulation time and solver settings for accurate results.

3. How can I verify the accuracy of my transfer function in Simulink?

To verify the accuracy of your transfer function in Simulink, you can compare the output of the simulation with the expected output from analytical calculations. You can also use the Simulink Control Design tools to perform frequency response analysis and compare the results with your transfer function's theoretical frequency response.

4. Can I use Simulink to design a transfer function?

Yes, Simulink offers several tools and blocks that can assist in designing a transfer function. You can use the Control System Designer or the PID Tuner to design and optimize your transfer function's parameters. You can also use the Transfer Fcn block to create a customized transfer function based on your design specifications.

5. How do I export the transfer function from Simulink for use in other software?

You can export the transfer function from Simulink in a variety of formats such as MATLAB code, C code, or transfer function coefficients. To do so, you can use the Export block or the MATLAB Function block. You can also use the Simulink Coder to generate code for your transfer function that can be used in other software or hardware platforms.

Similar threads

Replies
4
Views
2K
  • Electrical Engineering
Replies
5
Views
34K
Replies
18
Views
35K
  • Electrical Engineering
Replies
4
Views
8K
  • Electrical Engineering
Replies
8
Views
15K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • Electrical Engineering
Replies
30
Views
4K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
1K
Back
Top