MATLAB: High frequency input on Ideal transformer

high frequency transformersimulink

Halo everyone.
I'm trying to model a rectifier with a high frequency transformer at a switching frequency of 20Mhz. But whenever I increase the frequency signal at the input of the transformer, the output amplitude gets lower and lower.
I've attached a scope view. The scope shows a frequency of 60Hz and 1000Hz. The output of the 1000Hz is much lower.
Does anyone know why this happens.
Thanks.

Best Answer

I just tried this with a simple example model and saw the same behavior at 1000 Hz. This happens because, as you increase the frequency, you should also make sure to decrease the maximum allowable time-step in the Simulink solver.
I went into Simulation > Model Configuration Parameters (Ctrl+E), Solver pane, and changed the "Max time step" parameter to 1e-4. This made the input and output waveform look correct for my 1000 Hz simulation.
Note that, because of Nyquist sampling frequency, the largest sample time you should be using would be 1000*2 = 2000 Hz, or 5e-4. Therefore, you want to make sure your model is using something quite a bit smaller. This is how I arrived at 1e-4 as an "okay" number.
- Sebastian