How to measure the transfer function in Simulink?

Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
4 replies · 3K views
jean28
Messages
83
Reaction score
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
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...
 
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
 
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
 


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.