Hi All,
I am working on a system that would generate output with a particular type of square wave as input as long as an input condition (coming from a subsystem) is above a certain threshold. I tried using If statement but it seems not working. Could you please help? Here is my code. Effectively, what I am looking for is, when the output response (‘coupling’) of the system (‘TF1’) with the square wave defined as ‘inwave’ as the input is >= 0.015, the system output (‘v1’) should be the ‘inwave’ itself. It Otherwise it should be 0. It is working fine up to the plotting the ‘coupling’ signal. But the problem is with the If statement.
Thanks for your kind help.
TF1 = TransferFunctionModel[
Unevaluated[{{(697052. + 25694.6 s)/(
700128. + 25835.5 s + 1. s^2)}}], s, SamplingPeriod ->None,
SystemsModelLabels -> None];
PulseWave[duty_, t_, period_, phase_] :=
UnitBox[Mod[(t/period) + phase, 1]/(2 duty)];
inwave = 110*10^-3 PulseWave[0.25, t, 10^-2, 0] - 70*10^-3;
coupling = OutputResponse[TF1, inwave, {t, 0, 10 10^-2}];
Plot[coupling, {t, 0, 10 10^-2}]
v1 = If[coupling >= 0.015, inwave, 0];
Plot[v1, {t, 0, 10 10^-2}, PlotRange -> All]