Borrar filtros
Borrar filtros

How to scale a value in matlab

10 visualizaciones (últimos 30 días)
A R el 21 de Feb. de 2020
Comentada: A R el 25 de Feb. de 2020
Hi, I have a 1x256 data (modulated data of an image) in the range -8.9 to 48.7 which i want to transmit to analog output pin 0 of MCC USB. (USB 205 has 2 analog output pins) The usb 205 only takes data within 0-5 V. So i converted my 1x256 data to 0-5 V using min and max function and pushed it to the DAQ and it works well.
z=1x256 data
Now i have to convert b and c values within 0-5V so that I can transmit these values to analog output pin 1 of daq. Please share your suggestions.
Thank you!!

Respuestas (1)

Bhaskar R
Bhaskar R el 21 de Feb. de 2020
req_data = rescale(data, 0, 5);
  3 comentarios
Bhaskar R
Bhaskar R el 21 de Feb. de 2020
Editada: Bhaskar R el 21 de Feb. de 2020
"In statistics, the range of a set of data is the difference between the largest and smallest values - "
Here you are passing a single(for only 2 inputs aslo you get output as lower and upper limits as output) value to MATLAB function, that function is designed to set lower limit if you pass only single value as first input instead of set of data.
For the single/double input value you can apply thresholding condition but normalization can apply for set of the data(mupltiple values at a time)
>> x = 5:5:50
x =
5 10 15 20 25 30 35 40 45 50
>> rescale(x, 0, 5)
ans =
0 0.5556 1.1111 1.6667 2.2222 2.7778 3.3333 3.8889 4.4444 5.0000
You need to take at least 3 values of data so that to normalize
A R el 25 de Feb. de 2020
Thanks!! It really helped.

Iniciar sesión para comentar.


Más información sobre Image Data Workflows en Help Center y File Exchange.


Community Treasure Hunt

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

Start Hunting!

Translated by