Group Abstract Group Abstract

Message Boards Message Boards

1
|
7.4K Views
|
3 Replies
|
4 Total Likes
View groups...
Share
Share this post:

[?] Put 2 different plots inside a manipulation?

Posted 8 years ago
POSTED BY: Mike Luntz
3 Replies

I made my share of mistakes with my first attempt. This may be more like what you want, with two distinct controls and correct syntax for ArcTan:

Manipulate[
 Row[{Plot[{Norm[p] Sin[2 \[Pi] t + ArcTan @@ p], 
     Norm[q] Sin[2 \[Pi] t + ArcTan @@ q]}, {t, 0, 1}, 
    PlotRange -> {{0, 1}, {-3, 3}}, PlotStyle -> {Red, Blue}, 
    ImageSize -> Medium],
   Spacer[20], 
   Graphics[{Locator[Dynamic@p, Background -> Red], 
     Locator[Dynamic@q, Background -> Blue]}, PlotRange -> 2, 
    Frame -> True]}],
 {{p, {1, 1}}, {-2, -2}, {2, 2}, ControlType -> None},
 {{q, -{1, 1}}, {-2, -2}, {2, 2}, ControlType -> None}]
POSTED BY: Gianluca Gorni
Posted 8 years ago

Gianluca,

Thanks for the suggestion. That has given me some things to think about. I guess I don't really understand your solution so maybe you can explain it some. When I ran your suggestion I only ended up with a single control, but in spite of that the single slider seemed to control both sinusoids in some unexplained way. I expected to have a pair of controls, each controlling its own sinusoid. Just to let you know, this is just a simplifying example for my real problem. What I am really trying to do is to manually move around pole/zero pairs of an all-pass filter to see their effect on compensating group delay of another filter. There will likely be several pole/zero pairs needed to compensate the filter, thus multiple controls required.

BTW, thanks for cleaning up my original code. I was so focused on the problem of controls that I wasn't even thinking about the example function I wanted to plot.

Mike

POSTED BY: Mike Luntz

For this particular example a 2D slider works quite well:

Manipulate[
 Plot[{Norm[p] Sin[2 \[Pi] t + ArcTan[p]], 
   Norm[p] Sin[2 \[Pi] t + ArcTan[p]]}, {t, 0, 1}, 
  PlotRange -> {{0, 1}, {-3, 3}}],
 {{p, {0, 0}}, {-2, -2}, {2, 2}}]

A variation:

Manipulate[
 Row[{Plot[{Norm[p] Sin[2 \[Pi] t + ArcTan[p]], 
     Norm[p] Sin[2 \[Pi] t + ArcTan[p]]}, {t, 0, 1}, 
    PlotRange -> {{0, 1}, {-3, 3}}],
   Graphics[Locator[Dynamic@p], PlotRange -> 2, Frame -> True]}],
 {{p, {0, 0}}, {-2, -2}, {2, 2}, ControlType -> None}]
POSTED BY: Gianluca Gorni
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard