Community Profile

photo

the cyclist


Last seen: Today
4,582 total contributions since 2011

Data scientist at Cohen Veterans Bioscience; Obsessive runner. Professional Interests: Predictive modeling, statistics. (I don't respond to email via author page, but will usually look at a question if you send me a link to it.)

Contact

the cyclist's Badges

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

View all

Contributions in
View by

Answered
string for figure title ignores text after variable
Write it as one string, with the variable in the midst of it" t = 8.2; titlestr=sprintf('Time=%6.5f sec',t(1)); title(titles...

3 days ago | 0

| accepted

Answered
random selection of number among 2 numbers
Here are a couple ways: 2*randi([0 1]) 2*round(rand())

3 days ago | 1

Answered
How can I get un-descend index of latent in pca function
My answer to this question gives a detailed explanation of how to use MATLAB's pca function, including how to reduce the number ...

3 days ago | 1

| accepted

Answered
Feature vector dimension reduction (PCA)
I have written an answer to this question that explains in detail how to use MATLAB's pca function, including how to do dimensio...

3 days ago | 0

| accepted

Answered
Error using vertcat Dimensions of arrays being concatenated are not consistent.
data3 = [data1 data2] will concatenate them horizontally rather than vertically. You can do that, because they have the same nu...

7 days ago | 0

| accepted

Answered
build an array y depending on x
You have a few problems to fix: As you can see in its documentation, the input function requires you to include some prompting ...

8 days ago | 0

Answered
Unique numbers, not ordered
I believe this does what you want: X1 = [1 23 36 45 47 2]'; X2 = [1 36 47 2 6 ]'; X3 = [1 22 23 47 2 4]'; ...

8 days ago | 0

Answered
Input from PCA to train in SVM
I have written a "tutorial" on how to use and interpret MATLAB's pca function here. Lots of users have asked questions (some of ...

10 days ago | 0

| accepted

Answered
Assign a label to a point of a matrix in if statement
By default, Kappa_j is going to be a numeric array, and there cannot accept character input. Instead, you could define it as a c...

11 days ago | 1

| accepted

Answered
Subtraction of set value from specific elements in column once criteria met
threshold = 5000; % Set this to the limit value you want x(x>threshold) = x(x>threshold) - 65535;

13 days ago | 0

| accepted

Answered
calling script in another script
This question and answer should help you.

13 days ago | 0

Answered
Binary Logistic Regression - beginner
If you have the Statistics and Machine Learning Toolbox, you can use the fitglm function to fit a binomial logistic regression. ...

16 days ago | 0

| accepted

Answered
conversion double to array
If you want your 34x1 double to be in a single cell of a cell array, then ... inder = rand(34,1); inderCell1 = {inder} If you...

16 days ago | 0

| accepted

Answered
Reproduce a best-fit 4-parameter sigmoid
It is difficult when you say you have no idea. But, here are a few thoughts. If you have never used MATLAB at all, then you hav...

17 days ago | 0

Answered
the "taylor" function does not work for me (beginner)
In the assignment statement for T3, you capitalized "Taylor". MATLAB is case-sensitive, so you must use "taylor".

18 days ago | 2

Answered
Iterator goes infinite when changing step from 1 to 0.1
It's difficult to follow exactly what it going on in your code. I haven't traced the logic completely, but I figured out that wh...

18 days ago | 0

| accepted

Answered
Shorten the values from a column in another column.
The specific solution is potentially very dependent on ... the input format -- there are several way to read in Excel, leading ...

18 days ago | 0

| accepted

Answered
Operations with function handles / anonymous functions
Is this what you want? function1 = @(x) x(1)^2+5 function2 = @(x) 2*x(2) function12 = @(x) function1(x) + function2(x)

18 days ago | 1

| accepted

Answered
Shorten the values from a column in another column.
If these are numeric values, I think maybe you can do output_values = unique(floor(input_values)); But see my comment above, f...

18 days ago | 0

Answered
Covariance matrix as a diagonal matrix or not??????
I am definitely not an expert in this, but my guess is that these statements might only be strictly true for signals of infinite...

19 days ago | 0

Answered
summing columns based on certain interval
The best answer will depend on what specifically you want the output to be, and also how generalizable the solution needs to be....

19 days ago | 0

| accepted

Answered
How to delect the zero values in table
If all of the table entries are numeric, then this will work: % Create an example input table x = [0; 1; 0; 2]; y = [0; 1; 0;...

19 days ago | 0

| accepted

Answered
Exponent error calculating integral.
I expect you want phi.^3 instead of phi^3 inside your function fun

19 days ago | 0

Answered
How to generate a sparse matrix for a given array?
Here is one way: A = [1 3; 1 4; 2 3; 2 5; 3 5; 4 5]; d = max(A(:)); B = sparse(A(:,1),A(:,2...

20 days ago | 1

Answered
Assign rank to values in a matrix
Here is one way. (I did a smaller array, so the result is easier to verify.) % Set random seed for reproducibility rng default...

20 days ago | 1

| accepted

Answered
use mvnrnd with some conditions
Let's take this small example in which we generate just 3 pairs of correlated random numbers: n=3; % Generate 3 pairs, instead ...

23 days ago | 0

Answered
change variable in function_handle
I think this is what you mean? % Define f f=@(x) sin(x); % Derive g from f g = @(x) f(x+2); % Show that it gives expected r...

24 days ago | 0

| accepted

Answered
How to change legends' name
Here is a basic way you can do it: N = 3; figure hold on for ii = 1:N plot(rand(1,7),'DisplayName',sprintf('Theta %d'...

25 days ago | 0

| accepted

Answered
I want answer b for all value of N but it only read for latest value of N and value b become zero for 1st and 2nd of N. How i fix this problems?
I think you want b = (a*A*f)./(pi*Dm*N); I suggest you read Array vs. Matrix operations.

25 days ago | 0

| accepted

Answered
How do you load m-files that contain filenames with integers and strings?
Use the %d notation, and a cell array for storing: for ii = 1:50 B{ii} = load(sprintf('TTsim%dVariable.mat',ii)); end

25 days ago | 0

Load more