Logarithmic Scale Slider for GUI MATLAB

I'm having trouble to create a slider for GUI in MATLAB. I really want a slider that ranges from 10^-1 to 10^-5. But that has intervals by factors of 0.1. So the the slider would have a logarithmic scale. Anyone know how to solve this problem?

Answers


I'm not really sure if I understood you right. If you want to make logarithmic scale from linear scale:

Definition of logarithm:

So if you need to slider from 10^-1 to 10^-5 you want to get from your slider some value and convert it properly. I suggest to set your min and max to 1 and 5 (or -5 and -1) and after every slider callback or just use of slider value convert using this equation:

y = 10^(-x)

Where y is your wanted value and x is a value in a slider. In a code it should be similar to this:

logValue = 10^(-get(hObject,'Value'));
set(handles.text2,'string',logValue);

Check this method by putting in your gui some kind of text box that would show you your y.

But if you want to make linear scale from logarithmic:

 y = log(x)

Need Your Help

Share Image from Gallery to MyApp using Framework7.js in Cordova

android cordova webintents html-framework-7

Stuck with a this thing, I am using Framework7.js at present. Please help me, any other alternative will also be appreciated. Android is the platform I am operating on

Reading input pins with johnny-five and arduino

javascript node.js arduino johnny-five

I'm working on an application using node.js and arduino.