Dynamically updating density graphs with values from slider in MATLAB
Clash Royale CLAN TAG#URR8PPP
up vote
1
down vote
favorite
I have two complex data matrices $A,B$. I can combine them using functions $f(A,B,x,y),g(A,B,x,y)$. For simplicity, say my functions are $f(A,B,x,y)=xA+yB$ and $g(A,B,x,y)=xA-yB$. I would like to graph the functions $|f(A,B,x,y)|$, $argleft(f(A,B,x,y)vphantom^2right)$, $|g(A,B,x,y)|$ and $argleft(g(A,B,x,y)vphantom^2right)$ in MATLAB and have them dynamically update as I change the values of $x$ and $y$ using sliders. Is this possible? A couple of hours of googling and playing around with my code taught me a few things about sliders but not how to combine them with graphs.
So far, I've managed to place the four graphs in a single figure, but I have no idea how to include the sliders in the figure, have them update the values of $x$ and $y$ and have the graphs respond accordingly. Here's my code:
figure;
h=;
h(1)=subplot(3,2,1);
h(2)=subplot(3,2,2);
h(3)=subplot(3,2,3);
h(4)=subplot(3,2,4);
h(5)=subplot(3,2,5);
h(6)=subplot(3,2,6);
image(abs(xA+yB),'CDataMapping','scaled','Parent',h(1)),colormap(autumn),set(gcf,'name','linear combination...','numbertitle','off'),xlabel(''),ylabel('');
image(angle(xA+yB),'CDataMapping','scaled','Parent',h(2)),colormap(autumn),set(gcf,'name','linear combination...','numbertitle','off'),xlabel(''),ylabel('');
image(abs(xA-yB),'CDataMapping','scaled','Parent',h(3)),colormap(autumn),set(gcf,'name','linear combination...','numbertitle','off'),xlabel(''),ylabel('');
image(angle(xA-yB),'CDataMapping','scaled','Parent',h(4)),colormap(autumn),set(gcf,'name','linear combination...','numbertitle','off'),xlabel(''),ylabel('');
I've included a third row of subplots to place the sliders in, but if that isn't the correct way to do it I can simply remove h(5)
and h(6)
and change all the subplot(3,2,...)
s to subplot(2,2,...)
s.
Thanks!
graphing-functions
add a comment |Â
up vote
1
down vote
favorite
I have two complex data matrices $A,B$. I can combine them using functions $f(A,B,x,y),g(A,B,x,y)$. For simplicity, say my functions are $f(A,B,x,y)=xA+yB$ and $g(A,B,x,y)=xA-yB$. I would like to graph the functions $|f(A,B,x,y)|$, $argleft(f(A,B,x,y)vphantom^2right)$, $|g(A,B,x,y)|$ and $argleft(g(A,B,x,y)vphantom^2right)$ in MATLAB and have them dynamically update as I change the values of $x$ and $y$ using sliders. Is this possible? A couple of hours of googling and playing around with my code taught me a few things about sliders but not how to combine them with graphs.
So far, I've managed to place the four graphs in a single figure, but I have no idea how to include the sliders in the figure, have them update the values of $x$ and $y$ and have the graphs respond accordingly. Here's my code:
figure;
h=;
h(1)=subplot(3,2,1);
h(2)=subplot(3,2,2);
h(3)=subplot(3,2,3);
h(4)=subplot(3,2,4);
h(5)=subplot(3,2,5);
h(6)=subplot(3,2,6);
image(abs(xA+yB),'CDataMapping','scaled','Parent',h(1)),colormap(autumn),set(gcf,'name','linear combination...','numbertitle','off'),xlabel(''),ylabel('');
image(angle(xA+yB),'CDataMapping','scaled','Parent',h(2)),colormap(autumn),set(gcf,'name','linear combination...','numbertitle','off'),xlabel(''),ylabel('');
image(abs(xA-yB),'CDataMapping','scaled','Parent',h(3)),colormap(autumn),set(gcf,'name','linear combination...','numbertitle','off'),xlabel(''),ylabel('');
image(angle(xA-yB),'CDataMapping','scaled','Parent',h(4)),colormap(autumn),set(gcf,'name','linear combination...','numbertitle','off'),xlabel(''),ylabel('');
I've included a third row of subplots to place the sliders in, but if that isn't the correct way to do it I can simply remove h(5)
and h(6)
and change all the subplot(3,2,...)
s to subplot(2,2,...)
s.
Thanks!
graphing-functions
1
I think stackoverflow is a more appropriate site to post this question.
– callculus
Aug 2 at 17:52
1
Thanks. I've posted it there.
– Rain
Aug 2 at 19:07
You´re welcome and good luck.
– callculus
Aug 2 at 19:10
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I have two complex data matrices $A,B$. I can combine them using functions $f(A,B,x,y),g(A,B,x,y)$. For simplicity, say my functions are $f(A,B,x,y)=xA+yB$ and $g(A,B,x,y)=xA-yB$. I would like to graph the functions $|f(A,B,x,y)|$, $argleft(f(A,B,x,y)vphantom^2right)$, $|g(A,B,x,y)|$ and $argleft(g(A,B,x,y)vphantom^2right)$ in MATLAB and have them dynamically update as I change the values of $x$ and $y$ using sliders. Is this possible? A couple of hours of googling and playing around with my code taught me a few things about sliders but not how to combine them with graphs.
So far, I've managed to place the four graphs in a single figure, but I have no idea how to include the sliders in the figure, have them update the values of $x$ and $y$ and have the graphs respond accordingly. Here's my code:
figure;
h=;
h(1)=subplot(3,2,1);
h(2)=subplot(3,2,2);
h(3)=subplot(3,2,3);
h(4)=subplot(3,2,4);
h(5)=subplot(3,2,5);
h(6)=subplot(3,2,6);
image(abs(xA+yB),'CDataMapping','scaled','Parent',h(1)),colormap(autumn),set(gcf,'name','linear combination...','numbertitle','off'),xlabel(''),ylabel('');
image(angle(xA+yB),'CDataMapping','scaled','Parent',h(2)),colormap(autumn),set(gcf,'name','linear combination...','numbertitle','off'),xlabel(''),ylabel('');
image(abs(xA-yB),'CDataMapping','scaled','Parent',h(3)),colormap(autumn),set(gcf,'name','linear combination...','numbertitle','off'),xlabel(''),ylabel('');
image(angle(xA-yB),'CDataMapping','scaled','Parent',h(4)),colormap(autumn),set(gcf,'name','linear combination...','numbertitle','off'),xlabel(''),ylabel('');
I've included a third row of subplots to place the sliders in, but if that isn't the correct way to do it I can simply remove h(5)
and h(6)
and change all the subplot(3,2,...)
s to subplot(2,2,...)
s.
Thanks!
graphing-functions
I have two complex data matrices $A,B$. I can combine them using functions $f(A,B,x,y),g(A,B,x,y)$. For simplicity, say my functions are $f(A,B,x,y)=xA+yB$ and $g(A,B,x,y)=xA-yB$. I would like to graph the functions $|f(A,B,x,y)|$, $argleft(f(A,B,x,y)vphantom^2right)$, $|g(A,B,x,y)|$ and $argleft(g(A,B,x,y)vphantom^2right)$ in MATLAB and have them dynamically update as I change the values of $x$ and $y$ using sliders. Is this possible? A couple of hours of googling and playing around with my code taught me a few things about sliders but not how to combine them with graphs.
So far, I've managed to place the four graphs in a single figure, but I have no idea how to include the sliders in the figure, have them update the values of $x$ and $y$ and have the graphs respond accordingly. Here's my code:
figure;
h=;
h(1)=subplot(3,2,1);
h(2)=subplot(3,2,2);
h(3)=subplot(3,2,3);
h(4)=subplot(3,2,4);
h(5)=subplot(3,2,5);
h(6)=subplot(3,2,6);
image(abs(xA+yB),'CDataMapping','scaled','Parent',h(1)),colormap(autumn),set(gcf,'name','linear combination...','numbertitle','off'),xlabel(''),ylabel('');
image(angle(xA+yB),'CDataMapping','scaled','Parent',h(2)),colormap(autumn),set(gcf,'name','linear combination...','numbertitle','off'),xlabel(''),ylabel('');
image(abs(xA-yB),'CDataMapping','scaled','Parent',h(3)),colormap(autumn),set(gcf,'name','linear combination...','numbertitle','off'),xlabel(''),ylabel('');
image(angle(xA-yB),'CDataMapping','scaled','Parent',h(4)),colormap(autumn),set(gcf,'name','linear combination...','numbertitle','off'),xlabel(''),ylabel('');
I've included a third row of subplots to place the sliders in, but if that isn't the correct way to do it I can simply remove h(5)
and h(6)
and change all the subplot(3,2,...)
s to subplot(2,2,...)
s.
Thanks!
graphing-functions
asked Aug 2 at 17:32


Rain
317
317
1
I think stackoverflow is a more appropriate site to post this question.
– callculus
Aug 2 at 17:52
1
Thanks. I've posted it there.
– Rain
Aug 2 at 19:07
You´re welcome and good luck.
– callculus
Aug 2 at 19:10
add a comment |Â
1
I think stackoverflow is a more appropriate site to post this question.
– callculus
Aug 2 at 17:52
1
Thanks. I've posted it there.
– Rain
Aug 2 at 19:07
You´re welcome and good luck.
– callculus
Aug 2 at 19:10
1
1
I think stackoverflow is a more appropriate site to post this question.
– callculus
Aug 2 at 17:52
I think stackoverflow is a more appropriate site to post this question.
– callculus
Aug 2 at 17:52
1
1
Thanks. I've posted it there.
– Rain
Aug 2 at 19:07
Thanks. I've posted it there.
– Rain
Aug 2 at 19:07
You´re welcome and good luck.
– callculus
Aug 2 at 19:10
You´re welcome and good luck.
– callculus
Aug 2 at 19:10
add a comment |Â
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2870313%2fdynamically-updating-density-graphs-with-values-from-slider-in-matlab%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
1
I think stackoverflow is a more appropriate site to post this question.
– callculus
Aug 2 at 17:52
1
Thanks. I've posted it there.
– Rain
Aug 2 at 19:07
You´re welcome and good luck.
– callculus
Aug 2 at 19:10