32 views (last 30 days)
Show older comments
Demosthenis Kasastogiannis about 5 hours ago
Edited: Demosthenis Kasastogiannis about 2 hours ago
Dear All,
Kindly ask for your assistant, I am trying to generate a time series with approx 500 data with the following parameters
1)values between min=0 max=1500
2) 0-100 range 50% of total data, 101-200 25% of total data etc
3) x/x+1 data should be +/-10% at 20% of data, x/x+1 should be between +/-10% - +/-20 at 15% of total data etc
Any ideas will be highly appreciated
2 Comments Show NoneHide None
Show NoneHide None
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/2145924-random-number-generation-with-parameters#comment_3239244
Edited: John D'Errico 8 minutes ago
What does this mean:
3) x/x+1 data should be +/-10% at 20% of data, x/x+1 should be between +/-10% - +/-20 at 15% of total data etc
does it say something about the ratio of consecutive terms? And what exactly does it say? I'm sorry, but that line is highly confusing.
Demosthenis Kasastogiannis about 1 hour ago
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/2145924-random-number-generation-with-parameters#comment_3239294
Edited: Demosthenis Kasastogiannis about 1 hour ago
Apologies for the poor description...
Concerning the third parameter let me provide an example.
100,120,135..... the percentage difference if 100 and 120 is 20% (100x 1,2) while the percentage difference of 120 and 135 is 12,5%. As such i would like to determine the number of % differences within the generated data series as let's say 0%-10% differences at 20% of the entire data (is 500*20% = 100 data), 10%-20% difference at 15% of the entire data (500*15% = 75 data) etc. Hope it is more clear now. As i do want to generate consecutive data with 50% and 60% differences, it will be usefull if the generated data of ranges (0-100, 101 -200, 201-300 etc) are not continuously ie 100,275,510 etc
Many thanks!!!
Sign in to comment.
Sign in to answer this question.
Answers (1)
Amith 32 minutes ago
Open in MATLAB Online
Hi Demosthenis,
I understand that you want to generate random numbers based on a few rules/parameters.
The first and second conditions can be met using the `randi` function. For instance, you can generate 50% of the total data size (i.e., 500 numbers) within the range of 0-100. The next 20% of the data can be in the range of 101-200, while the remaining numbers can fall within the range of 201-1500. For example, to generate the first 100 numbers in the range of 0-100, you can use:
r = randi([0 100],1,100)
However, the third condition is unclear and somewhat confusing. It would be helpful if you could provide more details or elaborate further on it.
Hope this helps!
1 Comment Show -1 older commentsHide -1 older comments
Show -1 older commentsHide -1 older comments
Demosthenis Kasastogiannis about 1 hour ago
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/2145924-random-number-generation-with-parameters#comment_3239289
Edited: Demosthenis Kasastogiannis about 1 hour ago
Thank you very much Amith!! It is Highly appreciated
Concerning the third parameter let me provide an example.
100,120,135..... the percentage difference if 100 and 120 is 20% (100x 1,2) while the percentage difference of 120 and 135 is 12,5%. As such i would like to determine the number of % differences within the generated data series as let's say 0%-10% differences at 20% of the entire data (is 500*20% = 100 data), 10%-20% difference at 15% of the entire data (500*15% = 75 data) etc. Hope it is more clear now. As i do want to generate consecutive data with 50% and 60% differences, it will be usefull if the generated data of ranges (0-100, 101 -200, 201-300 etc) are not continuously ie 100,275,510 etc
Many thanks!!!
Sign in to comment.
Sign in to answer this question.
See Also
Tags
- random number generator
- discrete distribution
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
An Error Occurred
Unable to complete the action because of changes made to the page. Reload the page to see its updated state.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- Deutsch
- English
- Français
- United Kingdom(English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)
Contact your local office