フィルターのクリア

Info

この質問は閉じられています。 編集または回答するには再度開いてください。

How to use two sliders logarithmically spaced to update the plot on the same figure as the sliders are moved?

1 回表示 (過去 30 日間)
subharthi chowdhuri
subharthi chowdhuri 2017 年 8 月 27 日
閉鎖済み: subharthi chowdhuri 2017 年 8 月 27 日
Hello all, I am facing quite a problem with the usage of sliders. I have created a function which takes two inputs a and b, and accordingly, returns x and y. I plot x and y on a log-log axis to see how the output behaves.
Now I want to create two sliders for a and b spaced logarithmically, so by moving both of the sliders, I can see how the plot changes. I want to update my current figure with the change in a and b through the sliders.
I am at my wit's end on how to solve this problem and I would greatly acknowledge help from the people here.
Thanks, Subharthi
  4 件のコメント
Jan
Jan 2017 年 8 月 27 日
編集済み: Jan 2017 年 8 月 27 日
The slider works with a linear range and steps only, but it is trivial to calculate the exponentional (not logarithm):
uicontrol('Style', 'Slider', 'Min', 0, 'Max', 3, ...
'SliderStep', [0.1, 0.1], ...
'Callback', @SliderCallbackA);
...
function SliderCallbackA(SliderH, EventData)
Value = get(SliderH);
a = 10 ^ Value;
disp(a)
... now do with a what you want:
updateDiagram('a', a);
% And in the other slider callback:
% updateDiagram('b', a);
end
Creating two sliders works exactly as creating one slider, only do it twice. Perhaps you want to share the values of a and b in the handles struct. Search for "share variables between callbacks" in the forum.
You did not provide any code yet, therefore my "updateDiagram" is a bold guess only. Again: Please post, what you have tried so far, such that suggesting the further steps does not require to guess the complete code.
subharthi chowdhuri
subharthi chowdhuri 2017 年 8 月 27 日
Hi Jan,
Thanks a lot for your help. I have been able to solve this problem.
Subharthi

回答 (0 件)

この質問は閉じられています。

製品

Community Treasure Hunt

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

Start Hunting!

Translated by