Feeds
답변 있음
How to sum n lines of a matrix to another matrix?
n=2; TotalApit = reshape(sum(reshape(Apit,[n 102/n 5 1000])),[102/n 5 1000]);
How to sum n lines of a matrix to another matrix?
n=2; TotalApit = reshape(sum(reshape(Apit,[n 102/n 5 1000])),[102/n 5 1000]);
6년 초과 전 | 0
답변 있음
Determining the max angle from the cell array
This should do. Change |ncells| as desired. ncells = length(Ang_F1); max_edges_anglesR = max(angle(reshape(cell2mat(Ang...
Determining the max angle from the cell array
This should do. Change |ncells| as desired. ncells = length(Ang_F1); max_edges_anglesR = max(angle(reshape(cell2mat(Ang...
6년 초과 전 | 0
| 수락됨
답변 있음
what is the MATLAB function to evaluate ncr value when n is real
If |n| and |r| are both non-negative integers, and |n >= r|, use: nCr = nchoosek(n,r) If n and/or r can be negative, yo...
what is the MATLAB function to evaluate ncr value when n is real
If |n| and |r| are both non-negative integers, and |n >= r|, use: nCr = nchoosek(n,r) If n and/or r can be negative, yo...
6년 초과 전 | 2
| 수락됨
답변 있음
Multiplying two matrices of probabilities with different sizes.
I don't think there is anything wrong with your code. What is wrong is your interpretation of the outcome of multiplying your ma...
Multiplying two matrices of probabilities with different sizes.
I don't think there is anything wrong with your code. What is wrong is your interpretation of the outcome of multiplying your ma...
6년 초과 전 | 0
답변 있음
Plot trajectory colorized according to the standard deviation
Plot your data as a |surface| with zero height. x = vector_of_latitudes; y = vector_of_longitudes; z = zeros(size(...
Plot trajectory colorized according to the standard deviation
Plot your data as a |surface| with zero height. x = vector_of_latitudes; y = vector_of_longitudes; z = zeros(size(...
6년 초과 전 | 0
답변 있음
picking maximum difference across entries of row vectors, Part 3
A = [NaN NaN 3 9 4 ; 1 100 NaN 34 12]; maxdiffs = max(sort(A,2),[],2) - min(sort(A,2),[],2);
picking maximum difference across entries of row vectors, Part 3
A = [NaN NaN 3 9 4 ; 1 100 NaN 34 12]; maxdiffs = max(sort(A,2),[],2) - min(sort(A,2),[],2);
6년 초과 전 | 0
| 수락됨
답변 있음
Extract structure array elements into seperate matrix
No, that syntax won't work. If you want a one-liner, here's one alternative: extracted = cellfun(@(x) x(1,2), {data.datablo...
Extract structure array elements into seperate matrix
No, that syntax won't work. If you want a one-liner, here's one alternative: extracted = cellfun(@(x) x(1,2), {data.datablo...
거의 7년 전 | 0
| 수락됨
답변 있음
How can I find columns with all zeros in my matrix?
cols_with_all_zeros = find(all(A==0)); % all zeros cols_with_3_nonzeros = find(sum(A~=0)==3); % exactly 3 non-zeros
How can I find columns with all zeros in my matrix?
cols_with_all_zeros = find(all(A==0)); % all zeros cols_with_3_nonzeros = find(sum(A~=0)==3); % exactly 3 non-zeros
거의 7년 전 | 3
| 수락됨
답변 있음
Finding the first element of a 1-D array that yields a negative result.
x = normrnd(0,1,[1,20]); % generate 20 random numbers y = x(find(x<0,1)); % assign the first negative random value to y
Finding the first element of a 1-D array that yields a negative result.
x = normrnd(0,1,[1,20]); % generate 20 random numbers y = x(find(x<0,1)); % assign the first negative random value to y
대략 7년 전 | 0
답변 있음
How to multiply matrices using a for loop
p = rand(4,1); % 4x1 vector P = rand(4,4); % 4x4 matrix pstar = 10; while p(1)<pstar % stop multiplying if p(1) reach...
How to multiply matrices using a for loop
p = rand(4,1); % 4x1 vector P = rand(4,4); % 4x4 matrix pstar = 10; while p(1)<pstar % stop multiplying if p(1) reach...
대략 7년 전 | 0
답변 있음
Find unique in matrix of x,y coordinates
Did you try this? [C,IA] = unique(A,'rows'); |C| contains all unique rows of |A|. |IA| contains the indices of the rows...
Find unique in matrix of x,y coordinates
Did you try this? [C,IA] = unique(A,'rows'); |C| contains all unique rows of |A|. |IA| contains the indices of the rows...
대략 7년 전 | 0
답변 있음
How do I create a for loop for the this example?
You can use |eval|. Something like this should work, although you need to take care of saving your variables at the end of each ...
How do I create a for loop for the this example?
You can use |eval|. Something like this should work, although you need to take care of saving your variables at the end of each ...
대략 7년 전 | 0
| 수락됨
답변 있음
How to sample Multinomial Distribution
It is difficult to read your question. Please use underscore to separate your variable names from subscripts. Here's a solution ...
How to sample Multinomial Distribution
It is difficult to read your question. Please use underscore to separate your variable names from subscripts. Here's a solution ...
대략 7년 전 | 1
| 수락됨
답변 있음
How to plot 3d line on fit function?
You need to use |hold on|. For example, x = rand(100,1); y = rand(100,1); z = x.^2 + y; sf = fit([x, y],z,'poly...
How to plot 3d line on fit function?
You need to use |hold on|. For example, x = rand(100,1); y = rand(100,1); z = x.^2 + y; sf = fit([x, y],z,'poly...
대략 7년 전 | 0
| 수락됨
답변 있음
Element by Element Subtraction
|minus| operator in Matlab can inherently handle this, so you don't need a loop. Checkout >> |help minus|. For your case, some...
Element by Element Subtraction
|minus| operator in Matlab can inherently handle this, so you don't need a loop. Checkout >> |help minus|. For your case, some...
대략 7년 전 | 0
답변 있음
how to change Function value intiialization? mine is start with 0. i want start with -1
f = zeros(1,length(t)) - 1;
how to change Function value intiialization? mine is start with 0. i want start with -1
f = zeros(1,length(t)) - 1;
대략 7년 전 | 0
답변 있음
Edit/deleted the question
You need to read this article on indexing: <https://www.mathworks.com/company/newsletters/articles/matrix-indexing-in-matlab.htm...
Edit/deleted the question
You need to read this article on indexing: <https://www.mathworks.com/company/newsletters/articles/matrix-indexing-in-matlab.htm...
대략 7년 전 | 0
답변 있음
quadprog 'trust-region-reflective' algorithm error
As you said, _the only limit to the use of this algorithm is that only equality constraints or bound constraints can be used but...
quadprog 'trust-region-reflective' algorithm error
As you said, _the only limit to the use of this algorithm is that only equality constraints or bound constraints can be used but...
대략 7년 전 | 1
답변 있음
Sorting from the maximum value to minimum value in a vector
A=[2 5 8 7 8 9 3 7 6 5 4 1]; Asorted = sort(A,'descend'); % sorted from max to min [~,indx] = unique(Asorted); equalp...
Sorting from the maximum value to minimum value in a vector
A=[2 5 8 7 8 9 3 7 6 5 4 1]; Asorted = sort(A,'descend'); % sorted from max to min [~,indx] = unique(Asorted); equalp...
대략 7년 전 | 1
| 수락됨
답변 있음
Setting similar scale for two graphs
You need to use |plot(x,y)| instead of |plot(y)|, where |x| is the vector of x-values at which you want to plot |y|. For example...
Setting similar scale for two graphs
You need to use |plot(x,y)| instead of |plot(y)|, where |x| is the vector of x-values at which you want to plot |y|. For example...
대략 7년 전 | 0
답변 있음
ANOVAN with possibility of matrix as an input (columns as the variables)
The complex syntax of |anovan| allows you to handle the case of unbalanced data. Since you have the same number of observations ...
ANOVAN with possibility of matrix as an input (columns as the variables)
The complex syntax of |anovan| allows you to handle the case of unbalanced data. Since you have the same number of observations ...
대략 7년 전 | 0
| 수락됨
답변 있음
One-tailed test using the ranksum function
Your premise that "we should always get h=0, irrespective of the value of ‘alpha’" is not correct. Please see the definition of...
One-tailed test using the ranksum function
Your premise that "we should always get h=0, irrespective of the value of ‘alpha’" is not correct. Please see the definition of...
대략 7년 전 | 0
답변 있음
Plot det(matrixA - (x * eye(3))) where x = 0:3
You want to do this for each value of |x|, so |x| must be treated as a scalar, not as a vector. A = rand(3); % do for some ...
Plot det(matrixA - (x * eye(3))) where x = 0:3
You want to do this for each value of |x|, so |x| must be treated as a scalar, not as a vector. A = rand(3); % do for some ...
대략 7년 전 | 0
| 수락됨
답변 있음
Why am I getting such a large number on the initial iteration?
The problem is that you are overwriting the variable |n| inside the loop, so it changes value from |100| to |10|. Changes: ...
Why am I getting such a large number on the initial iteration?
The problem is that you are overwriting the variable |n| inside the loop, so it changes value from |100| to |10|. Changes: ...
대략 7년 전 | 0
답변 있음
row of all 8’s
N = 10; X = ones(N); % create a matrix of 1s X = [X(1:N-3,:) ; 8*ones(1,N) ; X(N-2:end,:)]; % add a row of 8s between (N...
row of all 8’s
N = 10; X = ones(N); % create a matrix of 1s X = [X(1:N-3,:) ; 8*ones(1,N) ; X(N-2:end,:)]; % add a row of 8s between (N...
대략 7년 전 | 0
| 수락됨
답변 있음
working out acceleration from 2 matrices- HELP
It is not correct to put a |0| when you don't know the value of acceleration. Instead, you should define a new vector of time po...
working out acceleration from 2 matrices- HELP
It is not correct to put a |0| when you don't know the value of acceleration. Instead, you should define a new vector of time po...
대략 7년 전 | 0
답변 있음
How can I make an array of handles?
You don't need an array of handles to do that. You can use arrayfun like this: x = 1:5; y = 5; z = arrayfun(@(x,y) 3*...
How can I make an array of handles?
You don't need an array of handles to do that. You can use arrayfun like this: x = 1:5; y = 5; z = arrayfun(@(x,y) 3*...
7년 초과 전 | 0
답변 있음
Adding noise to EEG dataset
I assume you're getting an error in this line: X = dataset + 2*randn(size(t)); because |dataset| is an |N x 2| array, wh...
Adding noise to EEG dataset
I assume you're getting an error in this line: X = dataset + 2*randn(size(t)); because |dataset| is an |N x 2| array, wh...
7년 초과 전 | 0
| 수락됨
답변 있음
Multiplying part of vector with another vector repeatedly without for loop
Try using |repmat|: s = sequence(:).*repmat(carrier(:),N,1); % N is the no.of 10-element segments in 'sequence'
Multiplying part of vector with another vector repeatedly without for loop
Try using |repmat|: s = sequence(:).*repmat(carrier(:),N,1); % N is the no.of 10-element segments in 'sequence'
7년 초과 전 | 0
| 수락됨
답변 있음
How can I deal with missing data ?
What kind of calculations are you doing? For basic operations such as |sum|, |mean|, |std|, |max|, |median| etc., you can use...
How can I deal with missing data ?
What kind of calculations are you doing? For basic operations such as |sum|, |mean|, |std|, |max|, |median| etc., you can use...
7년 초과 전 | 0