3
$\begingroup$

I have a question here regarding how to derive multiple output from OutputResponse or in general. Here is a screenshot of the codesenter image description here

As seen, I have only one quantity plotted. Tried google but didn't manage to find a solution.

Thanks in advance!

The codes are here:

ω = 2. Pi*50; Mag = 1; θ = 0.;

Tαβ2dqInv22 = {{Cos[ω t], -Sin[ω t]}, 
{Sin[ω t], Cos[ω t]}};
Tαβ2dq22 = {{Cos[ω t], 
    Sin[ω t]}, {-Sin[ω t], Cos[ω t]}};

Inputαβ22 = {Mag Cos[ω t + θ], 
   Mag Cos[ω t + θ]};
(*Inputαβ22={Mag ,Mag};*)

Outαβ2dq22 = 
  FullSimplify[Tαβ2dq22.Inputαβ22] // 
   TrigReduce;

g[t_] = OutputResponse[
   TransferFunctionModel[(0.67/(0.0025 s + 1) + 1)/(0.0025 s), s], 
   Outαβ2dq22[[1]], t];
f[t_] = OutputResponse[
   TransferFunctionModel[(0.67/(0.0025 s + 1) + 1)/(0.0025 s), s], 
   Outαβ2dq22[[2]], t];

Plot[{g[t], f[t]}, {t, 0, 0.2}, PlotRange -> Automatic]
$\endgroup$
1
  • $\begingroup$ Welcome to Mathematica.SE! 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour and check the faqs! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! $\endgroup$
    – user9660
    Commented Dec 14, 2016 at 17:52

2 Answers 2

3
$\begingroup$

Is this what you are looking for? The response to the two inputs:

res = Chop@Expand@
OutputResponse[
 TransferFunctionModel[(0.67/(0.0025*s + 1) + 1)/(0.0025*s), 
  s], #1, t] & /@ Outαβ2dq22;
Plot[res, {t, 0, 0.05}, PlotRange -> All]

enter image description here

$\endgroup$
1
  • $\begingroup$ Yes, that is what I want! Thank you! $\endgroup$
    – Peng
    Commented Dec 14, 2016 at 19:42
3
$\begingroup$

Suba has already done it.

tf = TransferFunctionModel[(0.67/(0.0025 s + 1) + 1)/(0.0025 s), s];
Outαβ2dq22 = FullSimplify[Tαβ2dq22.Inputαβ22] // TrigReduce // Chop;
Plot[Outαβ2dq22, {t, 0, 0.1}]

This is your input:

enter image description here

out1 = OutputResponse[tf, Outαβ2dq22[[1]], {t, 0, 0.2}];
out2 = OutputResponse[tf, Outαβ2dq22[[2]], {t, 0, 0.2}];

out3 = OutputResponse[tf, #, {t, 0, 0.2}] & /@ Outαβ2dq22;

You get the same output with out1 + out2 or out3:

Plot[{out1, out2}, {t, 0, 0.2}]

enter image description here

Plot[out3, {t, 0, 0.2}]

enter image description here

You have a network that only one source works. If both sources act, they must be linked to each other. Now a network on which two sources work and thus the answer to your question at the beginning " I have a question here regarding how to derive multiple output from OutputResponse or in general."

enter image description here

g1 = (uR - u1) s C1 + uR/R + (uR - u2)/(s L1);
sol = Solve[g1 == 0, uR];
iR = uR/R /. sol;
h1 = iR/u1 /. u2 -> 0; 
h2 = iR/u2 /. u1 -> 0;
tf = TransferFunctionModel[{Join[h1, h2]}, s]

enter image description here

T = 10^-3;
params= {L1 -> 1, C1 -> 0.1*10^-6, R -> 1000};
q1 = SquareWave[{0, 1}, (t + T/4)/T]; 
q2 = SawtoothWave[{0, 1}, t/T];
out = OutputResponse[tf /. params, {q1, q2}, {t, 0, 5 T}];

Show[
 Plot[{q1, 1000 out}, {t, 0, 5 T}, ExclusionsStyle -> Automatic, PlotStyle -> {Blue, Thick}],
 Plot[q2, {t, 0, 5 T}, ExclusionsStyle -> Automatic, PlotStyle -> Darker[Red]]
 ]

enter image description here

$\endgroup$
6
  • $\begingroup$ Thanks for another solution to the problem! Strangely, when I use function without defining time range in OutputResponse, the plot seems wrong. Why is that? g[t_] = OutputResponse[tf, Out\[Alpha]\[Beta]2dq22[[1]], t];' f[t_] = OutputResponse[ResoantFilter, Out\[Alpha]\[Beta]2dq22[[2]], t]; Plot[{g[t], f[t]}, {t, 0, 0.2}] $\endgroup$
    – Peng
    Commented Dec 14, 2016 at 19:36
  • $\begingroup$ Peng, look at the output of $f[t]$ or $g[t]$. Then you will see why I used Chop and Expand. If you add that, I think the problems you are seeing will go away. $\endgroup$ Commented Dec 14, 2016 at 19:55
  • $\begingroup$ @rewi a lot for me to learn from your latter part. Thanks! $\endgroup$
    – Peng
    Commented Dec 14, 2016 at 22:29
  • $\begingroup$ @Suba Thomas you were right. I can see what Chop is doing but for expand, I am not sure how it helps... $\endgroup$
    – Peng
    Commented Dec 14, 2016 at 22:31
  • $\begingroup$ Peng, I used Expand to get a cleaner picture of what was getting chopped. $\endgroup$ Commented Dec 14, 2016 at 22:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.