필터 지우기
필터 지우기

Interactive manipulation with graph in Matlab

조회 수: 2 (최근 30일)
Aleksandar
Aleksandar 2011년 7월 18일
Hi,
I am trying to plot a graph that has a filling underneath it, and a threshold value like a bar that can vary, so that the filling of the areas separated by the threshold is differently colored. I should be able to that by combining the functions "area" and "bar".
I would like to make the graph interactive, namely I would like to see how the graph would look like if the threshold value varies. Basically I am looking for something that is very similar to the "Manipulate" function in Wolfram Mathematica (link for reference):
Any suggestion would be greatly appreciated. Many thanks in advance!

답변 (2개)

Sean de Wolski
Sean de Wolski 2011년 7월 18일
Perhaps Doug's Challenge/Replies/Answer will be useful to you:
  댓글 수: 1
Aleksandar
Aleksandar 2011년 7월 18일
Thanks a lot! I also got another idea by using a slider which was the one I was hoping to get, but this one by using the mouse is also very intuitive. I will experiment with both of the approaches and see which one fits better to my needs.

댓글을 달려면 로그인하십시오.


Patrick Kalita
Patrick Kalita 2011년 7월 18일
You can achieve an effect similar to Mathematica's "Manipulate" by adding a uicontrol to your figure and programming it's Callback property to adjust the graph as needed. This requires some effort, but provides a lot of flexibility. Here is a very simple example:
% Make the plot
a = area( randn(1, 100) );
% Add a slider
uicontrol( ...
'Style', 'slider', ...
'Min', -3, ...
'Max', 3, ...
'Callback', @(src, evt) set(a, 'BaseValue', get(src, 'Value')));
  댓글 수: 1
Aleksandar
Aleksandar 2011년 7월 18일
Thanks a lot, this is exactly what I was looking for! I also got another idea by using the mouse which is also very intuitive. I will experiment with both of the approaches and see which one fits better to my needs.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Specifying Target for Graphics Output에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by