Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

randomly generate node sensor data(matlab)

Status
Not open for further replies.

pakitos

Advanced Member level 1
Joined
Nov 14, 2005
Messages
457
Helped
77
Reputation
154
Reaction score
35
Trophy points
1,308
Activity points
3,639
Hi there,
I have x nodes which read temperature

I want to randomly make sensors be either

1) faulty (random wrong reading) <normal or >normal
2) normal reading
3) fire detection reading

but want the probability of 2 higher than the other condition

how to do that?
thanks in advance
 

Hi pakitos,

use rand() function. It returns random numbers uniformly distributed between 0 and 1.
Let x=rand(1);
The probability that x is between 0 and p is p (p between 0 and 1);
The probability that x is between p1 and p2 is p2-p1 (p1, p2 between 0 and 1; p2>p1); ...etc...
Regards

Z
 

Hi, thanks for the reply
I am using the (rand(1,noNodes)>=0.8) formula
that generates 0 and 1 with the prob I have chosen.
I want if zero to generate randomly specific abnormal values if 1 random normal values

then another case if fire detection happens generate other set of data

my prob how to update data
thanks
 

It is not completely clear for me what do you mean by "randomly specific abnormal values", "random normal values", and " another case", but I guess you want something like this:
Suppose the probabilities of the different cases are P1 and P2 (and P3=1-P1-P2).

x = rand(1,noNodes);
faulty = (x<P1);
normal = ((x>=P1) & (x<P1+P2));
fire = (x>=P1+P2);
reading(faulty) = .............. random values with some distribution
reading(normal) = .............. random values with another distribution
reading(fire) = ............ other values


There are other ways (perhaps more clear if you are not familiar with Matlab) to have the same result, but ths is rather compact.
Regards

Z
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top