Using a variable frequency AC Voltage Source in Simulink

I'm trying to simulate a RLC circuit which measures the voltage and current across a component as frequency of the input voltage changes. The input voltage is from an AC Voltage Source. I've used Simulink to create the circuit and it works fine for individual values of f. But when I try to put in a range of values for the frequency I get the error message:
'Invalid setting in 'CircuitsQuestion2/V(t)' block.
Parameter 'Frequency' must be a scalar value. Component: Simulink | Category: Model error'
What am I doing wrong?

답변 (1개)

Sebastian Castro
Sebastian Castro 2016년 4월 14일

0 개 추천

You cannot enter a range (vector) of frequencies into the block. The AC voltage source block, as it is currently implemented, must retain a fixed frequency during the whole simulation.
That begs the question: Do you want to run separate simulations with different frequencies, or do you want to change the frequency of the signal over time during a single simulation?
There are solutions to both -- I just want to check with you first so I don't unload a wall of text up front :)
- Sebastian

댓글 수: 3

Well I'm looking to plot a graph with the results of the simulation, so changing the frequency of the signal over time during a single simulation would probably be more suitable. What would you suggest for this method?
Cheers
Henry
OK, so there's 2 approaches I can think of for varying frequency during simulation.
  • Using a Controlled Voltage source and creating the Sine Wave input using plain Simulink blocks: V = A*sin(wt + phi)
  • Customizing the source code of the AC Voltage Source Simscape block so it works with variable frequency. Luckily, I recently worked on this in another Answer :)
- Sebastian
Henry Taylor
Henry Taylor 2016년 4월 18일
편집: Henry Taylor 2016년 4월 18일
So if I am to use the source code method, how do I go about customising the source code? Do I just make a new script?
Alternatively, how would I go about using a Controlled Voltage source and creating the Sine Wave input?

댓글을 달려면 로그인하십시오.

질문:

2016년 4월 14일

편집:

2016년 4월 18일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by