2
$\begingroup$

I am trying to plot the predicted output of a multiple input/multiple output control to a disturbance as a function of a parameter (s). To simplify the example, the gain matrix is a small Toeplitz matrix and we will only consider the steady state behavior, i.e., we will calculate an array of control actions, u, that depend on the deviation from set point, d, by

u=-Inverse[g].d

g := Table[If[i == j, 1, If[Abs[i - j] == 1, s, 0]], {i, 1, 5}, {j, 1, 5}]

The control action is calculated by multiplying the inverse of the gain matrix times the array of disturbances (at various points). To keep the example simple, assume the disturbance is at one point so the control action becomes a column of the inverse gain matrix:

d := Transpose[Table[If[i == 3, -1, 0], {i, 1, 5}]]

and

u = -Inverse[g] . d

which gives

{(s^2 - s^4)/(1 - 4 s^2 + 3 s^4), (-s + s^3)/(1 - 4 s^2 + 3 s^4), ( 1 - 2 s^2 + s^4)/(1 - 4 s^2 + 3 s^4), (-s + s^3)/( 1 - 4 s^2 + 3 s^4), (s^2 - s^4)/(1 - 4 s^2 + 3 s^4)}

I want to plot how these elements of the control action array vary with s (for a much larger array of functions). I can create an array of points and use ListPlot3d, but the control action has poles in it and I would like to do a parametric plot to better represent the topology of the surface. How do I generate a parametric plot of an array of functions? I would prefer a surface plot rather than a series of line plots and I would like to do this for numerous more complex structures and disturbances (i.e., not cut and paste the array elements into a list for parametric plotting if I can avoid it).

$\endgroup$

1 Answer 1

0
$\begingroup$

Thank you. I ended up just using ListPlot3d to give plots like:enter image description here

nbolt := 11;
g := Table[
If[i == j, 1, If[Abs[i - j] == 1, s, 0]], {i, 
1, nbolt}, {j, 1,nbolt}];   
ginv = Inverse[g];
d := Transpose[Table[If[i == (4), -1, 0], {i, 
1, nbolt}]];
u := -Inverse[g] . d;
uArray := Table[u /. s -> i/100, {i, 1, 99}];
xmin := 0; xmax := 11; ymin := 0; ymax := 1; 
zmin := -6; zmax := 6;
t4 = ListPlot3D[uArray, ImageSize -> 800, 
Mesh->9, 
DataRange -> {{xmin, xmax}, {ymin, ymax}}, 
ViewPoint -> {1, -1.5, 1.5}, 
PlotLabel -> 
Style["Disturbance in lane 4 (tridiagonal)", 
FontSize -> 24], 
AxesLabel -> {Style["Lane number",  20], 
Style["Interaction parameter", FontSize -> 
FontSize ->20], 
Style["Action", FontSize -> 20]}]

This works except when I specify a range on z, I get an error message.

$\endgroup$
2
  • $\begingroup$ Please support your answer with Mathematica code (in addition to the presented image). $\endgroup$
    – Syed
    Dec 29, 2022 at 1:02
  • $\begingroup$ Here is the code (and the next challenge): $\endgroup$
    – Ted
    Dec 30, 2022 at 20:10

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.