Community Profile

photo

the cyclist


3,612 total contributions since 2011

Principal Scientist at PatientsLikeMe; Obsessive runner. Professional Interests: Predictive modeling, statistics.

Contact

the cyclist's Badges

  • Scavenger Finisher
  • 36 Month Streak
  • Thankful Level 3
  • Ace
  • Likeable
  • Famous
  • Quiz Master
  • Revival Level 3
  • Knowledgeable Level 4
  • First Answer
  • Puzzler
  • Speed Demon
  • Creator
  • Promoter
  • Commenter

View all

Contributions in
View by

Answered
how to make a curve of Poisson, Rayleih, t , ....etc distribution of my random data (in histogram)
If you have the Statistics and Machine Learning Toolboox, then you could use the fitdist function. It will fit a large variety o...

10 days ago | 0

| accepted

Answered
gevfit error: Operands to the || and && operators must be convertible to logical scalar values
That code works for me, in both 2018b and 2019a. Does this happen with a freshly started instance of MATLAB? If so, you might ...

17 days ago | 0

| accepted

Answered
how to find out wether the array is Hill or not?
I think this is right, but I have to admit I have not thoroughly checked it: % Original data a=[1,2,2,3,3,4,4,2,-1,-1]; % F...

18 days ago | 0

| accepted

Answered
are there workbook front ends for matlab?
Live scripts and functions are a notebook-like functionality within MATLAB.

24 days ago | 0

Answered
how can I generate data mixture of 2 Normal distributions and has the form f(x) = 0.4X1 + 0.6X2 where X1 ~ N(0.4 ,0.15^2) and X2 ~ N(0.7 , 0.09^2)?
Here is one way: % The number of random samples to generate N = 10000; % First, generate a binomial variable, which 40% of ...

30 days ago | 1

| accepted

Answered
Accumulate previous values in time serie
You should be able to use the movsum command.

1 month ago | 0

| accepted

Answered
Scanning a column in matrix with repeated values
This code does the initialization. I'm still trying to figure out what you mean about filling it in. [Edited afterward to fill ...

1 month ago | 0

| accepted

Answered
Finding boundaries of kmeans clustering
Use the centroid coordinates as input to the voronoi command. xy1 = [randn(50,1) randn(50,1)]; xy2 = [randn(50,1)+5 randn(50...

1 month ago | 0

Answered
How do I only keep specific values in an array of numbers?
You could do intersect(yourArray,65:90) You also should not use sort as a variable name, because it is a MATLAB keyword. You w...

1 month ago | 0

| accepted

Answered
plotting projectile with drag
If I increase cd to a very large value, for example cd=10000; then I see the impact of drag -- the trajectory is no longer a p...

1 month ago | 0

Answered
Assign different colors to multiple plots without loop
Here is one way: ColorSpec = [0 0 0; 1 0 0; 0 1 0; 0 0 1]; % Pretend data x = sor...

1 month ago | 0

| accepted

Answered
calculate total percentage on either side of histogram
Taking a very different tack ... maybe you'd find the cdfplot command useful?

2 months ago | 0

Answered
Why does 7*(0.1) - 0.7 = 1.1102e-16 whereas 9*(0.1)-0.9 =0 in MATLAB?
See the section "Accuracy of Floating-Point Data" in this documentation page. Some of those combinations are represented by the...

2 months ago | 0

Answered
Rearranging a Vector Back Again
% Original x x = [0 0 1 1 0 1 0 0 1 1]; % Sorted x [x_sorted,indices]=sort(x,2); % Original x recovered from the sorted...

2 months ago | 0

| accepted

Answered
How do you transpose a part of a column into more rows in Matlab?
If X is your original matrix ... Y1 = reshape(X,3,3,[]); Y2 = permute(Y1,[2,1,3]); Y3 = reshape(Y2,3,9); Y3 is the matrix yo...

2 months ago | 2

| accepted

Answered
Which mldivide ('\') function is better
I highly doubt that a bug was found in mldivide later than 2008, so I doubt the later function is "more correct" or "more accura...

2 months ago | 0

Answered
Selecting a range of X values from an array
ind = find(data(:,1)>630 & data(:,1)<700);

2 months ago | 1

| accepted

Answered
Create a loop to find Beta for each period, OLS
The first thing I notice is that absolutely nothing inside of your for loop depends on i. So, the output of your loop will be id...

2 months ago | 0

Answered
Couldn't find the position of a value in vector
The value is not exactly equal to 0.05, due to floating point representation. Try tol = 1.e-6; k=find(abs(q-0.0500)<tol); Rea...

2 months ago | 0

| accepted

Answered
I have a problem with plotting two vectors, I want to vary 'z' by a certain amount and 'x' by another amount and plot versus each other, how can i make the matrix dimensions match?
Well, it's really up to you to decide. You have a 24-element vector, and a 28-element vector. Which of those elements align wit...

2 months ago | 0

Answered
How to create an array/card bank to add elements into later and be empty at the start
Yes, there is a way to do this. (I am tempted to stop there, because that was your question.) It's not very clear what sort of ...

2 months ago | 0

Answered
Polyfit is not showing the expected fit
The reason is that when you call polyfit with three output arguments, it performs centering and scaling. Try this instead: [p,S...

2 months ago | 3

Answered
How can I convert a character vector that includes date time and random text to datetime format?
Guessing at the pattern ... s = '2018-05-19_07.11.16_test6.csv' idx = regexp(s,'_') d = s(1:idx(1)-1) t = s(idx(1)+1:idx(2)...

2 months ago | 1

| accepted

Answered
Is it Necessary to De-Mean my Data before Applying PCA, or does pca(X) do that Automatically?
MATLAB's pca functions definitely de-means. It should make no meaningful difference if you de-mean ahead. Are you sure you are ...

2 months ago | 0

| accepted

Answered
Correlation matrix of two vectors of the same length
This will happen regardless of whether or not you have NaN values in your vectors, because what you are asking for is not very s...

2 months ago | 0

| accepted

Answered
How to set bins correctly when graphing a pdf
The height of the pdf does not give the probability. The height of the pdf times the width of the interval gives the probability...

2 months ago | 0

Answered
What can I do to make this function run faster? I feel like it takes longer than I'd like and i want some optimization tips.
A few thoughts: Broadly, you should learn how to <https://www.mathworks.com/help/matlab/matlab_prog/profiling-for-improving-p...

2 months ago | 1

Answered
How to select one number from a loop. I want to calculate the time t when m5=99.9. when I run the program it doesn't show anything. I don't know how to print t from the time loop when m5=99.99
The reason you don't an exact match has to do with the representation of <https://www.mathworks.com/help/matlab/matlab_prog/floa...

2 months ago | 0

| accepted

Answered
Making plots in matlab
You could use the <https://www.mathworks.com/help/matlab/ref/plot.html |*plot*|> command. You could use the <https://www.math...

3 months ago | 0

| accepted

Answered
Merge table with different rows
I'm guessing you need the <https://www.mathworks.com/help/matlab/ref/table.join.html join> command.

3 months ago | 0

Load more