Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
How to make the output always be betweeb 0 and 1

Subject: How to make the output always be betweeb 0 and 1

From: Dharini Pathmanathan

Date: 24 Jun, 2010 04:08:21

Message: 1 of 3

Please help!
This is part of my script.

pb=[];
pb(1)=exp(-lam)

for k=1:n
pb(k+1)=(lam/k)*pb(k)
end

I want the values of pb to always be between 0 and 1. How do I specify this in my program?
Thank you.

Subject: How to make the output always be betweeb 0 and 1

From: darthshak

Date: 2 Jul, 2010 11:56:46

Message: 2 of 3

You could divide all elements by the largest value.

Subject: How to make the output always be betweeb 0 and 1

From: Roger Stafford

Date: 2 Jul, 2010 19:59:05

Message: 3 of 3

darthshak <vishakadatta@gmail.com> wrote in message <1451346959.59803.1278071836993.JavaMail.root@gallium.mathforum.org>...
> You could divide all elements by the largest value.
- - - - - - - - -
  That is not necessary, Darthshak. None of the elements in pb can ever exceed or even become as large as 1. See the argument in the duplicate thread

http://www.mathworks.com/matlabcentral/newsreader/view_thread/285332

Roger Stafford

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us