How to map the values from 0-320 to 0-29

2 visualizaciones (últimos 30 días)
kintali narendra
kintali narendra el 16 de Nov. de 2016
Editada: per isakson el 16 de Nov. de 2016
Hi, I want to map values using matlab, but I don't know,How to do it. I want to map 0-320 to 0-29.There are many such mappings which I want to, Please tell me how to do it. Thanks
  2 comentarios
KSSV
KSSV el 16 de Nov. de 2016
What do you mean by mapping? Can you given an example?
per isakson
per isakson el 16 de Nov. de 2016
Editada: per isakson el 16 de Nov. de 2016
Something like this?
>> map = @(x) 0 + ((29-0)/(320-0)).*x;
>> map(0)
ans =
0
>> map(320)
ans =
29
>> map(0:80:320)
ans =
0 7.2500 14.5000 21.7500 29.0000

Iniciar sesión para comentar.

Respuestas (1)

Massimo Zanetti
Massimo Zanetti el 16 de Nov. de 2016
Just multiply your values by 29/320;
k = 29/320;
%generate some random numbers between 0 and 320
x = 320*rand(5);
%map them to [0,29]
y = k*x

Categorías

Más información sobre NaNs 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