Message Boards Message Boards

GROUPS:

Get the output of a square-wave input?

Posted 6 years ago
6639 Views
|
2 Replies
|
0 Total Likes
|

Hello! I am trying to get the electrical response of a system to an input square wave. Here is the code:

ClearAll["Global`*"];

Rf = 10^7;

A = 10000;
\[Omega]pd = 2 Pi 100;
\[Omega]gbp = A \[Omega]pd;
\[Tau] = 1/\[Omega]pd;
Cj = 10^-12;
Cf = 10^-12;
H[s_] = A/(A + (Cf + Cj) Rf \[Tau] s^2 + s (A Cf Rf + Cj Rf + \[Tau]));

BodePlot[TransferFunctionModel[H[s], s]];

T = 2*10^-5;
TMAX = 4*10^-5;

in = OutputResponse[TransferFunctionModel[1, s], 
   SquareWave[t/T], {t, 0, TMAX}];
out = OutputResponse[TransferFunctionModel[H[s], s], 
   SquareWave[t/T], {t, 0, TMAX}];

Plot[{in, out}, {t, 0, TMAX}, PlotRange -> {0, 2}]

This works well, but if I put Rf = 10^6; instead of 10^7, I get this error:

At t == 9.999999999999726`*^-6, step size is effectively zero; \ singularity or stiff system suspected. >>

Thanks for the help!

POSTED BY: Mario R
2 Replies

I just ran your code with Rf=10^6 and no error was produced. Which version are you using? See the image below generated with version 11 on a MAC computer

yehudaenter image description here

Posted 6 years ago

Mathematica 10.4 Student Edition

POSTED BY: Mario R
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract