Community Profile

photo

the cyclist


3,733 total contributions since 2011

Data scientist at Cohen Veterans Bioscience; 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
Taking middle 4 values of n size array
Here is one way, assuming the number of elements is even: % Input a = rand(1,8); numberElements = numel(a); numberToRemove...

12 hours ago | 0

Answered
Taking middle 4 values of n size array
Here is one way, which will work for either even- or odd-length arrays. It is not efficient. % Input a = rand(1,9); whichEn...

12 hours ago | 0

Answered
write a function that takes any equation as an input
Are you familiar with anonymous functions? That would presumably be the best way to pass "any function" as an argument. Then in...

14 hours ago | 1

| accepted

Answered
linearly spacing a nX1 matrix
Your problem is still under-specified, and an infinite number of matrices will meet you conditions. Here is one possible solutio...

16 hours ago | 0

| accepted

Answered
Find average y value of a range of numbers from a non linear data set
Your example of averaging the values from 6:10 would be mean(interp1(X,Y,6:10,"previous")) Change where I put 6:10 to be the a...

17 hours ago | 1

| accepted

Answered
Index exceeds array bounds from CorrCoeff
The problem is that in the first iteration of your loop, you are taking the correlation of two scalar values: corrcoef(X(1,1),X...

1 day ago | 0

Answered
How to print figure to an .eps file properly?
Try using '-opengl' rather than '-painters' for the renderer.

1 day ago | 0

Answered
Creating means in a table for a specific subnum
I think you might be able to do what you want using the groupsummary function.

3 days ago | 0

| accepted

Answered
How to print figure to an .eps file properly?
Try using export_fig.

3 days ago | 0

Answered
How to fit data to a curve with known error bars and draw it?
Do you mean that you want to do a fit where both your x and y variables have known measurement error? (Unlike, say, an ordinary ...

3 days ago | 0

Answered
Subscript indices must either be real positive integers or logicals.
Unlike some other programming languages (e.g. python), MATLAB has 1-based indexing. The first element of the array A would be re...

4 days ago | 0

Answered
Printing row index or row of a matrix by searching for a particular value?
rowIndex = find(mat(:,1)==31); % Row index row = mat(mat(:,1)==31,:); % Row Note that one doesn't need the find command to get...

4 days ago | 0

| accepted

Answered
How to plot below function of two variables
x = 0 : 0.02 : 2; % 2 is not equal to infinity, but it shows the behavior. y = 0 : 0.02 : 2; [xx,yy] = meshgrid(x,y); f =...

6 days ago | 0

| accepted

Answered
Relate a value obtained with values that formed it (Vector Relationship)
Assuming those are all numeric vectors of the same length, then [min_SLL,min_idx] = min(SLL); min_dx1 = dx1(min_idx); min_dy1...

6 days ago | 1

| accepted

Answered
How to reshape nested cell arrays in a table
Here is one way: t.Var2 = {reshape(t.Var2{:},4,12)} and analogously for Var3 and Var4. Parsing what that is doing, from the i...

7 days ago | 1

Answered
How to retrieve data from a website?
According to its documentation page, use of urlread is not recommended. It suggests using webread instead.

7 days ago | 0

Answered
How to crate only 5 plots out of the 20000 iterations?
Use if mod(k,5000)==0 ... end and just figure or figure(k/5000) Just using the figure command (without any argument)...

7 days ago | 0

| accepted

Answered
lagrangian polynomial function giving the incorrect answer
I don't have a solution for you, but I can say that the line xprod=xprod*((c-Xlist(j))/(Xlist(i)-Xlist(j))); is never reached ...

7 days ago | 1

Answered
Arrange be in order of their pairing, and count how many times they appear
[C,~,idx] = unique(B,'row'); D = accumarray(idx,A); 1 + 3 + 6 = 10. ;-)

8 days ago | 0

| accepted

Answered
Find a series of consecutive numbers and change index of them
Data(:,1) = cumsum(diff([Data(1,2); Data(:,2)]) ~= 1); will change the first column to what you want. That's might be a bit "o...

9 days ago | 2

| accepted

Answered
while loop mixing number with word
Use a cell array instead: i = 1; a = 5; while (i<10) student{i} = a a=a+5; i = i+1 end See this Answers tuto...

9 days ago | 0

Answered
Loop not working properly
What you are observing seems correct to me. theta is 0, and phi is constant. This means that even as r increases y is zero (be...

10 days ago | 0

| accepted

Answered
My licensed Mathworks products (Home Use License )
Quoting from my R2019a Home license agreement: A Named User may install the Programs on up to four (4) different Computers but ...

11 days ago | 0

Answered
How to save Figures using "print" with a filename from a variable?
It's a straightforward extension of what you are doing now. For example k = 1; y = 1989; sprintf('/Users/Figure3/figCI_%d_%d....

11 days ago | 0

| accepted

Answered
Interpolation using scattered query points
I believe the solution you point to can be trivially vectorized: load clown ; imagesc(X); colormap gray ; [nx,ny] = size(X) ...

11 days ago | 0

| accepted

Answered
Finding max value in intervals
Given your nicely separated peaks, I think you could simply use the 'MinPeakDistance' name-value pair, as was done in this examp...

11 days ago | 0

Answered
Can the following function be optimized further for speed?
The vecnorm function probably does some error- and type-checking which you don't need, and you can combine two square root opera...

12 days ago | 1

| accepted

Answered
How to solve a 5x5 matrix in Matlab?
A\b Take a look at this documentation. Does that do what you want?

12 days ago | 0

Answered
Changing directories after a function is ran
Depending on exactly how you want to do it, I expect the following command will be useful: ls -- to see the folder contents in...

14 days ago | 0

Answered
Creating an Array for Different Radial Positions
theta = 0; phi = pi/2; r = 1 : 0.2 : 10; theta = repmat(theta,size(r)); phi = repmat(phi, size(r)); [x,y,z] = sph2...

14 days ago | 0

| accepted

Load more