Tag Archives: Random

Random Numbers in Matlab – Part II

This is our second post in our series on random numbers in Matlab. The first post can be found here. In this post, I will explain how to control the random number generation functions in Matlab and discuss alternatives for projects with stronger requirements for randomness, such as cryptography.

Random number generation

Random number generation in Matlab is controlled by the rng function. This function allows the user to specify the seed and generation method used in random number generation as well as save the current settings so that past experiments can be repeated. By default, rng starts with a seed of zero and uses the Mersenne Twister generation method. Whenever Matlab restarts, the seed of rng is reset to zero, which means that the same random numbers will be generated in the same order every time Matlab is restarted. If avoiding this is desireable, use the ‘shuffle’ seed.

>> t = rng      %Stores current settings of rng in t
t = 

     Type: 'twister'
     Seed: 0
    State: [625x1 uint32]

>> rand(1,4)     %Generates a 1x4 random matrix with default initial
                 %state
ans =

    0.8147    0.9058    0.1270    0.9134

>> rand(1,4)     %Generates a 1x4 random matrix
                 %(different from initial random matrix)
ans =

    0.6324    0.0975    0.2785    0.5469

>> rng(t)        %Restore settings of rng
>> rand(1,4)     %New random matrix same as initial random matrix
ans =

    0.8147    0.9058    0.1270    0.9134
>> rng('shuffle')     %Seed rng on basis of current time
>> rng
ans = 

     Type: 'twister'
     Seed: 385954034
    State: [625x1 uint32]
>> rand(1,4)          %New random matrix produced with new seed
ans =

    0.5706    0.9136    0.4043    0.8423

As demonstrated in the above code, the settings of the random number generator rng can be saved and restored. The type, seed, and state of rng can always be accessed as well.

Alternatives to the Matlab rand function

The current version of Matlab uses the Mersenne Twister (MT) algorithm to generate pseudorandom numbers by default. Other algorithms can be selected with the rng function. The MT algorithm is used in many programming languages, including C++, Python, R, and Ruby, and is sufficiently robust for most engineering applications, such as Monte Carlo simulations. The rng function can generate pseudorandom numbers with other algorithms, including a combined multiple recursion number generator and a multiplicative lagged Fibonacci number generator.

To obtain numbers that are more random and independent, functions provided by various operating systems can be used. CryptGenRandom is the default Windows function used to provide random numbers that are meant to be sufficiently robust for cryptography. Despite being secret, the algorithm from Windows 2000 was found to be vulnerable to various attacks in 2007. In mid-2008, Microsoft released a patch to fix this vulnerability. Unix-like operating systems use /dev/random to generate random or pseudorandom numbers by harvesting entropy from the environment. This approach is also meant to be sufficiently robust for cryptography but has also been found to have flaws.

There are other pseudorandom and random number generators that are not linked to an operating system. The Fortuna algorithm can be used for cryptographic applications, but its use for engineering applications is unjustified because of its slow speed. The website Random.org claims to provide “truly” random numbers based on atmospheric noise. There is a Matlab script that can access random numbers from this site, which can be found on Matlab Central. If you use this script, remember that there is a quota of up to 1 million random bits for free usage.

In addition, there are other pseudorandom and random number generators that can be used for various numerical computing applications, which are beyond the scope of this blog post. In the next post, I will explain how to create more distributions by using the basic rand and randn functions provided by Matlab.

lg share en Random Numbers in Matlab – Part II

This entry passed through the Full-Text RSS service – if this is your content and you’re reading it on someone else’s site, please read the FAQ at fivefilters.org/content-only/faq.php#publishers.

Matlab Geeks

Random Numbers in Matlab – Part III

This is the final post in our series on random numbers in Matlab. In the first post, we discussed basic random number functions, and in the second post, we discussed the control of random number generation in Matlab and alternatives for applications with stronger requirements. In this post, we will demonstrate how to create probability distributions with the basic rand and randn functions of Matlab. This is useful in many engineering applications, including reliability analysis and communications.

How to Create More Distributions

Although the basic version of Matlab only provides the uniform and normal distributions, other distributions based on these functions can be generated. The log-normal, Rayleigh, and exponential distributions will be produced below as examples.

The log-normal distribution is easily.created by taking Euler’s number (e) to the power of a normal random variable (randn).

>> mu = 0;                %Mean of log(X)
>> sigma = 0.25;          %St. dev. of log(X)
>> N = 1000000;
>> nbins = 100;
>> X = exp(mu + sigma*randn(N,1));
>> hist(X, nbins);
>> xlabel('Value'); ylabel('Count'); 
>> title('Log-normal distribution')

lognormal Random Numbers in Matlab – Part III

The Rayleigh distribution is commonly used to model wireless communication channels and can be constructed easily in Matlab. A Rayleigh random variable is the square root of the sum of the squares of two independent normal distributions with zero mean (randn).

>> sigma = 0.5;        %Scale parameter
>> N = 1000000;
>> nbins = 100;
>> X1 = sigma*randn(N,1);
>> X2 = sigma*randn(N,1);
>> R = sqrt(X1.^2 + X2.^2);
>> hist(R, nbins);
>> xlabel('Value'); ylabel('Count'); 
>> title('Rayleigh distribution')

rayleigh Random Numbers in Matlab – Part III

The exponential distribution models the time between events in a Poisson process and can be created using the uniform distribution (rand).

>> lambda = 0.1;       %Rate parameter = 1/mean = 1/stdev
>> N = 1000000;
>> nbins = 100;
>> X = rand(N,1);
>> E = -log(X)/lambda;
>> hist(E, nbins);
>> xlabel('Value'); ylabel('Count'); 
>> title('Exponential distribution')

exponential Random Numbers in Matlab – Part III

As shown in this post, creating distributions on the basis of the simple Matlab functions rand and randn is easy and requires only a few lines of code. This is highly useful for a wide range of engineering and scientific applications. I hope these posts have helped you learn about the Matlab random number functions and will enable you to apply them to your own work.

lg share en Random Numbers in Matlab – Part III

This entry passed through the Full-Text RSS service – if this is your content and you’re reading it on someone else’s site, please read the FAQ at fivefilters.org/content-only/faq.php#publishers.

Matlab Geeks

Random thoughts: disruption, customer engagement and thee

I may not have a muse but I love to muse. I let those random thoughts float through my feverish brain and at some point they get organized enough to be put down on paper – albeit the digital version. It sort of follows a form of writing and a practice that I learned many years ago called “automatic writing” popularized by the Surrealist movement – no, they weren’t just painters. There was an actual political, social, and cultural component to surrealism. (If you want to read their manifesto, check out Andre Breton’s “Surrealist Manifesto”).

Automatic writing called for you to write down the first blush of your unadorned thoughts. In effect, whatever came to mind. Then the way that you refined and edited it was by writing the second, third, fourth, etc., pass of your thoughts “over” it.  If I remember correctly (and I may not) the thinking was that the second pass, even though it was what came to mind as opposed to editing the original scrivening, was “aware” of the first attempt and that connection impacted the second, third and fourth ad infinitum passes. Ultimately, you got a vividly written and highly refined work that wasn’t bound by the rules of editing but was bound only by the mind’s imagination as connected to the work you started. Try it sometimes. It’s fun and it works. 

What’s Hot on ZDNet

While these random thoughts aren’t exactly automatic writing, the subjects come to mind when I decide to pen the post.  So here you go.

So-called “disruption” versus….

Over the last few years, fueled by the hyperbole of Silicon Valley and the desire by a lot of excited entrepreneurs to be “the thing” that’s on the lips of everyone, we’ve seen the almost indiscriminate slinging around of “disruption” or “disruptive” for technologies that are far from that.

I’ve heard that Groupon is disruptive. Coupons. I’ve heard Uber is disruptive. Better taxi ride. I’ve heard an enormous number of young start-ups self-proclaim disruption. Raging young company ego. History will prove disruption, not proclamation.  

Disruption is the purview of very few, but it doesn’t require invention. In my view, there have been two technology companies that were disruptive over the last decade or more. First, salesforce.com because they managed to popularize cloud-delivered services (though they didn’t invent it) and changed the thinking and got the laws/regulations to accommodate this new way of delivering technology. They didn’t invent it, they made it something that all of business did in the way that they provided it. 

Second, Amazon.com, because they changed the way that a society bought its goods. They didn’t invent ecommerce. They made it something done by everyone and once again, the laws/regulations bent to accommodate what they did. Those are disruptions because they cause a transformation of how the society at large does something to its unique benefit – and they do it to a point that even law has to change to accommodate it.

Don’t get me wrong. There have been vast social, political, technological, and business upheavals that could be characterized as disruptive, i.e., they changed the way that things were done at scale – and the laws and regulations moved to adjust to them. Witness the 13th century transformation of agriculture that occurred. The results of this (more here in a piece I wrote a couple of weeks ago) were lots more people got to eat food of good quality – that’s disruptive. A lot more disruptive than Groupon, which delivers coupons, or Uber, a better way to get a ride. 

I guess if I had to define disruption it would be something that beneficially alters how the world does something at scale – to the point that the laws and regulations of the world change to accommodate it.

But then, that’s me. I’m sure there are lots of other perfectly good definitions of disruption out there.

Is this a “Post CRM” world?

At CRM Evolution, during the influencer panel, one of the intriguing discussions brought up by my great buddy and key influencer Denis Pombriant rotated around whether or not we were in a “post-CRM” world. I wasn’t there, trying to not talk so I could recover from vocal cord surgery, but the phrase “post-CRM” got me to thinking.

Here’s what I think. We are in a Post-CRM world in the sense that CRM is going to become a subordinate market to what I think is a much bigger customer engagement market. That doesn’t mean that CRM will go away – even as a term – or that CRM will no longer be needed. But the definition of CRM will be the definition that it has been de facto for years – it is a technology and a system that supports the operational and transactional aspects of customer facing business and the repository of the customer record.

The definition of CRM that I’ve supported for many years will become somewhat irrelevant in terms of market positioning. CRM strategy will be implementation strategy while what we have been calling CRM strategy for a long time will be referred to as customer engagement strategy. The strategies around customer experience, customer feedback, etc., will be part of an engagement strategy discussion. So, yeah, we are heading to a “post-CRM” world when it comes to the all-encompassing idea of CRM but CRM will essentially be what it has been for a long time – the system supporting the customer-facing operations of a business.

Customer Engagement technology messaging takes another step forward

What is fascinating about customer engagement technology is that it encompasses a lot – so much in fact that there is no single technology vendor who will be able to offer a complete customer engagement suite, though we might see a platform or two of substance. At this point, the easily discernible elements of customer engagement technology are:

  1. CRM as the system of record and operational driver
  2. Sales as social sales with the ability to communicate with customers
  3. Marketing technologies to help drive the first line of engagement with customers
  4. Customer journey “management” as either the means to create the paths for the ongoing interactions of customers or to track the interactions
  5. Feedback as one of the ways that the customer interacts with the company
  6. Gamification as one kind of system of engagement
  7. Customer engagement analytics to identify and anticipate customer behaviors
  8. Knowledge management in its contemporary form that incorporates not only subject matter expertise, but also elements of customer self-service.
  9. Customer service as a locus for engagement – see Michael Maoz, Gartner’s extraordinary analyst and his Customer Engagement Hub for a strong validation of this piece.
  10. Ecommerce – an element of customer engagement in the sense that it is a landing place for customers to interact and transact a la Amazon.  Focused as is CRM around the transactional side.
  11. Loyalty and Advocacy programs – engaging customers by incentivizing tthee
  12. Communities for interactions at scale that can be highly specifically focused. 
  13. Social Networks for broad interactions. 

There is much more that I’m just beginning to suss out. Eventually, this will become, for me, the centerpiece of a Customer Engagement Technology Matrix (CETM) that will identify what I hope is a complete customer engagement technology ecosystem. What technologies would it take to support the full engagement of a single customer and/or customers scaling to the millions? There is no one company that will be able to offer it, but those that can offer either the ecosystem through their own offerings and those of their partners or a portion of the ecosystem that supports the mission of the company will be those with a leg up on successful business as the 21st century continues on its merry way.

The vendors respond to the customer engagement

There is a rush in the customer facing part of the technology world to messaging around customer engagement. On the one hand, I welcome it, because it is an indicator of the top-of-mind thinking of the buyers around how to better engage customers in a way that provides benefit to both sides. On the same hand (different finger?), it is recognition of the formation and evolution of the customer engagement marketplace and its potentially lucrative possibilities. On the other hand, the vendors may lay claim to customer engagement or some part of it, but they have to have the portfolio or, even better, ecosystem, to back it up. Claim what you want, defend what you claim.

Here are some examples of what I’ve seen or heard so far. These are companies who are explicitly messaging around customer engagement or even have products named with that in the name. For now, I will leave out any judgment I might make about the veracity of their claims or the validity of the messaging, but trust me, in 2015, I’m going to be VERY judgmental. 

  1. Marketo – Have moved away from Revenue Performance Management – SO glad – to Engagement Marketing.
  2. NICE – Customer Engagement Analytics product
  3. Verint/KANA – Customer Engagement Analytics product
  4. SAP – Messaging around engagement “and commerce”
  5. Salesforce.com – Around the Marketing Cloud and in particular, the Customer Journey Builder and Journey Builder for Apps, explicit messaging around customer engagement. More to come I suspect.
  6. Thunderhead.com – A full bore framework – intellectual and practical – called “Engage 3.0”
  7. Pitney-Bowes – An amalgamated integrated customer engagement platform
  8. Moxie – Recent messaging around ecommerce, customer journeys and engagement (both employee and customer). They take a different spin than most since their discussion around journeys is fixing the problems identified by the journey mapping.

Notice something about these? Only a few of them will be directly competing. They are almost all coming at it from different angles. That’s what I mean. This is a BIG market with a lot of moving parts that are just getting organized into something that is discernible and describable and has a framework. I’m SO excited about this. It’s becoming fun again. 

Status updates of all kinds

  1. CRM Idol 2014– This year we limited the contest to no more than 25 companies. Only 22 actually qualified.  The first round of demos and presentations by the contestants is over and as of yesterday, the semi-finalists are announced. There are ten of them. They are (in alphabetical order):

    1. Converge Enterprise
    2. Grapevine6
    3. Helpshift
    4. Klever
    5. LanternCRM
    6. Really Simple Systems
    7. Red String Solutions
    8. SalesLoft
    9. Sparkcentral
    10. Walkme
  2. CRM Watchlist 2015 – The Watchlist registration has been underway since February. As of this morning, there are 103 companies registered – about the same pace as last year. Companies that have registered range from the traditional big companies to smaller startups with significant upside. I’d say we have 70 percent repeats and 30 percent new in the breakdown, which is what it tends to be every year as some of the new ones replace companies who don’t reregister. No registration, no win. If you want to register, you still have about a month before I close the registrations. Send me an email at paul-greenberg3@the56group.com asking for the registration form. If you are a PR firm representing a possible registrant, please tell me who that is. Telling me “for a client” isn’t enough to get me to send you one. The questionnaire, which will come to you after you send the registration form back, is due December 5 at 6pm Pacific Time filled out in full.
  3. The Commonwealth of Self Interest: Business Benefit, Customer Value  – I got some good news a couple of weeks ago. I’m thrilled to say Harvard Business Press is going to be the publisher of my next book “The Commonwealth of Self Interest” – a book that I’ll write in 2015 and focus around how to build an engagement strategy, program, and system for a company. I’m totally excited about it and hope it becomes as influential as CRM at the Speed of Light turned out to be. But you know the old saying, “Woodstock was great, Woodstock 2 sucked.” We shall see. Either way, I’m going to learn a lot and I hope (he says disingenuously) that those who are reading it learn a lot too. 

This entry passed through the Full-Text RSS service – if this is your content and you’re reading it on someone else’s site, please read the FAQ at fivefilters.org/content-only/faq.php#publishers.

ZDNet | Social CRM: The Conversation Blog RSS