Réponse apportée
Create vector with unique values
% I'm sure there is no repetition but the set of values is not random r = 1+randperm(5000)/5000; % check all(r>=1 & r<=2) ...

environ 4 ans il y a | 1

Réponse apportée
Interp1 Function gives back NaN in second to last datapoint
MATLAB interp1 by default gives NaN for query points falling outside your source points (first and last). Use 'extrap' option (...

environ 4 ans il y a | 0

| A accepté

A soumis


qsort
Sort data with user-supplied comparison function

environ 4 ans il y a | 1 téléchargement |

0.0 / 5

Réponse apportée
multiplying matrix by a vector on an element by element basis using for loops
To be able to compute A*B; You need B is column (vector): the number of rows of B much match the number of rows of A, 5 in this ...

environ 4 ans il y a | 0

Réponse apportée
How to sort eigenvalues when performing generalized nyquist criterion on 2x2 matrix?
Replace statement E1(:,k) = eig(Z_nyquist1); by % track eigen values ----------------------------------------------- ...

environ 4 ans il y a | 0

| A accepté

Réponse apportée
null() fails for a symbolic numeric 5x5 matrix
Just a wild guess but when you call null(A) with symbolic matrix, MATLAB tries to solve for lambda the equation det(A - lambda*...

environ 4 ans il y a | 0

Réponse apportée
Is cell2mat supposed to support non-plaid cell partitioning? If not, why not?
But this one works Ctlarge={rand(1,2) rand(1,1) rand(1,0); rand(3,1) rand(3,2) rand(3,0)} cell2mat(Ctlarge) You can edit the ...

environ 4 ans il y a | 1

| A accepté

Réponse apportée
How to concatenate first column of matrix A and first column of matrix B, then second column of matrix A and second column of matrix B and so on?
A = randi(10,2,3) B = randi(10,2,3) reshape([A;B], size(A,1), [])

environ 4 ans il y a | 0

Question


why wrapping with anonymous function speeds up?
I try to understand the rational behind this result. When I wrap a function within an anonymmous function, it runs almost 10 tim...

environ 4 ans il y a | 1 réponse | 1

1

réponse

Question


Profiler: time spend at while END statement
I run a profiler on my code, and it is reported a significant amount of time is at the "end" statement of a while loop (here i, ...

environ 4 ans il y a | 1 réponse | 0

1

réponse

Réponse apportée
split the matrix into two
A = randi(10,3,6) B = A(:,1:2:end) C = A(:,2:2:end)

environ 4 ans il y a | 0

| A accepté

Réponse apportée
How to find 5 consecutive values above threshold within a certain window?
A = [6 7 8 8 8 7 6 7 6 2 7 8 9 3 3 4 6 7 8 9] win = 5; threshold=5; maxreject=3; % Pad NaNs so that the length is multiple...

environ 4 ans il y a | 0

Réponse apportée
How to have Matlab create a random matrix that is fullrow rank?
Here is a way to generate finite condition number matrxix , meaning stronger than full rank, and it must give a full rank (unles...

environ 4 ans il y a | 1

Réponse apportée
Generalized sorting function with user defined (template-)criterion
AFAIK there is no such thing in stock function in MATLAB, the main reason is MATLAB function calling mechanism will kill the per...

plus de 4 ans il y a | 1

Réponse apportée
How to reshape an M x (aN) matrix into a (aM) x (N) matrix in MATLAB?
Use permute m = 3; n = 2; a = 4; A = reshape(zeros(m,n)+reshape(1:a,[1 1 a]),[m n*a]); A B = reshape(permute(reshape(A,[...

plus de 4 ans il y a | 1

| A accepté

Réponse apportée
Determining relative angular orientation of vectors
No need to call costly trigonometric functions % Direction of incidence Ray (normalized) Rayi = randn(2,1); Rayi = Rayi/norm(...

plus de 4 ans il y a | 0

Réponse apportée
I need to find the length of the longest strictly increasing subsequence array from a given array I just need a tip to start. Any type of help will be appreciated
Dynamic programming, it may take longtime for large array a = [0,1,2,3,4,1,2,0,4,5,8,9,11,11,4,4,9,9]; i = longestsubseq_helpe...

plus de 4 ans il y a | 0

| A accepté

Réponse apportée
How to solve the following type of equation that includes summation in matlab?
Assuming H_m and t_m are stored in (1 x M )arrays % Dummy test data M = 10; H = rand(1,M); t = rand(1,M); P = sum( abs(H...

plus de 4 ans il y a | 0

| A accepté

Réponse apportée
I need to find the length of the longest strictly increasing subsequence array from a given array I just need a tip to start. Any type of help will be appreciated
a=rand(1,1000000); idx=find(diff([false diff(a)>0 false])); [lgtmax, j]=max(idx(2:2:end)-idx(1:2:end)); longestincreasedsub...

plus de 4 ans il y a | 0

Réponse apportée
Sort vector A according to vector B
A = [0.9; 0.2; 0.4; 0.2; 0.3; 0.4; 0.7; 0.4; 0.1; 0.8; 0; 0; 0; 0]; B = [0; 0; 1; 1; 1; 1; 0; 0; 0; 0; 0; 0; 0; 0]; Ais0=A==...

plus de 4 ans il y a | 0

| A accepté

Réponse apportée
How to find the index of first and last nonzero elements in each column?
Some C-mex solution for speed: https://fr.mathworks.com/matlabcentral/fileexchange/24641-vectorized-find-with-first-option?s_ti...

plus de 4 ans il y a | 0

Réponse apportée
How to find the index of first and last nonzero elements in each column?
Let you do conversion to linear index A=[0 0 0 0 0 0 0 0 1 0 4 8 2 0 ...

plus de 4 ans il y a | 0

Réponse apportée
Symbolic multidimensional arrays with changable dimension
p = [1 2 3 4]; c = [1 2 3 4; 1 2 3 4; 1 2 3 4; 1 2 3 4]; n=3; M = p(:); % EDIT, bug fix for k=1:n-1 cc = reshape(c, [...

plus de 4 ans il y a | 0

| A accepté

Réponse apportée
What function in MATLAB for calculating the value of inverse standard normal distribution function?
There is no sense to substract 1 to *inverse* CPF, which take argument value in (0,1) and maps to (-Inf,Inf). It only makes sens...

plus de 4 ans il y a | 0

Réponse apportée
Making a spherical cap using equations of sphere
phi=linspace(pi/2,pi/6,30); % the cap end is determined by pi/6 change accordinglt theta=linspace(0,2*pi,120); r=3; [PHI,TH...

plus de 4 ans il y a | 0

| A accepté

Réponse apportée
Converting location of a 2x3 vector into a matrix with value 1
a = [1,3;2,4;7,8]; % assumed there is no repeated indexes A = accumarray(a,1,[10,10])

plus de 4 ans il y a | 1

Réponse apportée
Gaussian fiiting of a truncated data
Remove the data above 1.96 and fit with the rest.

plus de 4 ans il y a | 0

| A accepté

Réponse apportée
How do I generate a random number between two numbers with using a distribution
% define the siscrete value and their relative pdf xval=(-10:10); p=exp(-(xval/5).^2); % Gaussian function, triangular whateve...

plus de 4 ans il y a | 1

| A accepté

Réponse apportée
How do I create this full diagonal matrix
n = 5; A = n-abs((1:n)'-(1:n))

plus de 4 ans il y a | 0

Réponse apportée
How to partially validate arguments?
I believe the issue is that your argument isn't self consistent. When you use syntax such as optional_positional = 1 That mea...

plus de 4 ans il y a | 1

| A accepté

Charger plus