How to modify variables during Simulink simulation
7 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hi everyone, I am quite new to MATLAB and Simulink.
I am developing an high level simulation of a PLL and the input signal is being simulated with a sawtooth voltage source (pulse voltage control where the rise time and fall time are identical and the hold time is infinitely smaller than the latters) which is used as base signal for a PWM of a square wave (based on the sawtooth values, the duty cycle of the PWM changes).
I need to change the frequency of this sawtooth at a certain point during the simulation to measure how fast the PLL settles to the new frequency value.
The ideal way would be to change the frequency parameter in the model workspace during simulation, but this would mean that I need to generate the signal using a MATLAB Function Block (plus, I don't know why, but assignin doesn't allow me to change the model workspace when I put caller instead of base: the output says "For C/C++ code generation, the value of input workspace must be 'base'.").
I tried to do so, but multiple errors occur (e.g. the square pulse duration is not what the duty cycle should impose). You can try yourself to substitute the Frequency Changer block in the first implementation (pulse voltage source) with the constant square_freq and see how the pulses are 50ps shorter.
I attached the model for the generation and the base workspace that makes it work.
0 Commenti
Risposte (0)
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!